mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.4.27-rc3 with gcc-3.4.0 compile error (even with the fix patch)
@ 2004-07-25 20:03 haiquy
  0 siblings, 0 replies; 2+ messages in thread
From: haiquy @ 2004-07-25 20:03 UTC (permalink / raw)
  To: linux-kernel


Hi, I got the error when compiling ...

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

with gcc-3.3.3 all were okay.

Best regards,

Steve Kieu

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: 2.4.27-rc3 with gcc-3.4.0 compile error (even with the fix patch)
@ 2004-07-25 11:14 Mikael Pettersson
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Pettersson @ 2004-07-25 11:14 UTC (permalink / raw)
  To: haiquy, linux-kernel

On Sun, 25 Jul 2004 20:03:10 +0000 (UTC), haiquy@yahoo.com 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 */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-25 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-25 20:03 2.4.27-rc3 with gcc-3.4.0 compile error (even with the fix patch) haiquy
  -- strict thread matches above, loose matches on Subject: below --
2004-07-25 11:14 Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®