mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikael Pettersson <mikpe@csd.uu.se>
To: haiquy@yahoo.com, linux-kernel@vger.kernel.org
Subject: Re: 2.4.27-rc3 with gcc-3.4.0 compile error (even with the fix patch)
Date: Sun, 25 Jul 2004 13:14:46 +0200 (MEST)	[thread overview]
Message-ID: <200407251114.i6PBEkfs007288@harpo.it.uu.se> (raw)

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 */

             reply	other threads:[~2004-07-25 11:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-25 11:14 Mikael Pettersson [this message]
2004-07-25 20:03 haiquy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407251114.i6PBEkfs007288@harpo.it.uu.se \
    --to=mikpe@csd.uu.se \
    --cc=haiquy@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®