Re: 2.4.27-rc3 with gcc-3.4.0 compile error (even with the f…

Top Page

Reply to this message
Author: Mikael Pettersson
Date:  
To: haiquy, linux-kernel
Subject: Re: 2.4.27-rc3 with gcc-3.4.0 compile error (even with the fix patch)
On Sun, 25 Jul 2004 20:03:10 +0000 (UTC), haiquy@??? wrote:
>The kernel has the gcc-3.4 fix patch
>
>make[3]: Entering directory `/home/linux-2.4.27-rc3/drivers/usb/gadget'
>gcc-4 -D__KERNEL__ -I/home/linux-2.4.27-rc3/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fno-strength-reduce -ffast-math -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=athlon -fno-unit-at-a-time -nostdinc -iwithprefix include -DKBUILD_BASENAME=net2280 -DEXPORT_SYMTAB -c net2280.c
>net2280.c: In function `write_fifo':
>net2280.c:540: error: `typeof' applied to a bit-field
>net2280.c: In function `handle_ep_small':
>net2280.c:2194: error: `typeof' applied to a bit-field
>make[3]: *** [net2280.o] Error 1
>make[3]: Leaving directory `/home/linux-2.4.27-rc3/drivers/usb/gadget'
>make[2]: *** [first_rule] Error 2
>make[2]: Leaving directory `/home/linux-2.4.27-rc3/drivers/usb/gadget'
>make[1]: *** [_subdir_usb/gadget] Error 2
>make[1]: Leaving directory `/home/linux-2.4.27-rc3/drivers'
>make: *** [_dir_drivers] Error 2


Fetch and use the updated gcc-3.4 fix patch
<http://www.csd.uu.se/~mikpe/linux/patches/2.4/patch-gcc340-fixes-v3-2.4.27-rc3>
or apply the incremental patch below.

In the gcc-3.3 -> gcc-3.4 transition they changed gcc to
explicitly forbid using typeof on bitfields, see gcc
bugzilla #10333. This is not unreasonable, since typeof
and sizeof on bitfields can have strange semantics.

The fix for net2280.c (backported from the 2.6 kernel)
is to make the min calculation explicit in the code.

/Mikael

--- linux-2.4.27-rc3/drivers/usb/gadget/net2280.c.~1~    2004-04-14 20:22:20.000000000 +0200
+++ linux-2.4.27-rc3/drivers/usb/gadget/net2280.c    2004-07-25 12:47:30.000000000 +0200
@@ -537,7 +537,10 @@
    }

    /* write just one packet at a time */
-    count = min (ep->ep.maxpacket, total);
+    count = ep->ep.maxpacket;
+    if (count > total)    /* min() cannot be used on a bitfield */
+        count = total;
+
    VDEBUG (ep->dev, "write %s fifo (IN) %d bytes%s req %p\n",
            ep->ep.name, count,
            (count != ep->ep.maxpacket) ? " (short)" : "",
@@ -2191,7 +2194,8 @@
        unsigned    len;

        len = req->req.length - req->req.actual;
-        len = min (ep->ep.maxpacket, len);
+        if (len > ep->ep.maxpacket)
+            len = ep->ep.maxpacket;
        req->req.actual += len;

        /* if we wrote it all, we're usually done */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@???
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/