Skip to contentSkip to conversation

Compiling kernel with SuSE 8.2/gcc 3.3

DISCUSSION Steve French 4 participants 5 messages Jun 11, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · Stephan von Krawczynski

during tests with latest SuSE distro 8.2 compiling 2.4.21-pre6 showed a lot of "comparison between signed and unsigned" warnings. It looks like SuSE ships gcc

I also noticed lots of compiler warnings with gcc 3.3, now default in SuSE, and cleaned up most of them for the cifs vfs but there are a few that just
look wrong for gcc to spit out warnings on. For example the following
local variable definition and the similar ones in the same file
(fs/cifs/inode.c):

	__u64 uid = 0xFFFFFFFFFFFFFFFF;

generates a warning saying the value is too long for a long on x86 SuSE 8.2 with gcc 3.3 - which makes no sense. Any value above 0xFFFFFFFFF generates the same warning (intuitively
36 bits should fit in an unsigned 64 bit local variable).

Defining the literal with the UL suffix didn't seem to help - and I rebelled against the solutions that work for this case ie casting the local variable which is already __u64 to __u64 but that presumably would work for those three, as would a (__u64)cast of -1 which seems equally ugly). Unfortunately for the CIFS Unix Extensions these values really are supposed to be 64 bit
on the wire (0xFFFFFFFFFFFFFFFF indicating ignore setting this value).
In the current version of the cifs vfs (http://cifs.bkbits.net/linux-2.5cifs)
the only other case that now generates compiler warnings (in this case
signed/unsigned compares) is the comparison of unsigned local variables
to the literal PAGE_CACHE_SIZE (which presumably is interpreted as signed by the compiler).

Any idea what is going on in this weird gcc 3.3 behavior where it thinks 64 bits can't fit in a __u64 local variable?

#1 lore raw
Quoted 11 lines · Steve French
Quoted 2 lines · Stephan von Krawczynski

during tests with latest SuSE distro 8.2 compiling 2.4.21-pre6 showed a lot of "comparison between signed and unsigned" warnings. It looks like SuSE ships gcc

I also noticed lots of compiler warnings with gcc 3.3, now default in SuSE, and cleaned up most of them for the cifs vfs but there are a few that just
look wrong for gcc to spit out warnings on. For example the following
local variable definition and the similar ones in the same file (fs/cifs/inode.c):

Quoted 6 lines
	__u64 uid = 0xFFFFFFFFFFFFFFFF;

generates a warning saying the value is too long for a long on x86 SuSE 8.2 with gcc 3.3 - which makes no sense. Any value above 0xFFFFFFFFF generates the same warning (intuitively 36 bits should fit in an unsigned 64 bit local variable).

[SNIPPED...]

I think the compiler doesn't have a default type for something that long. Therefore you have to define is as:

__u64 uid = 0xFFFFFFFFFFFFFFFFULL;

Seems dumb, but it even works.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.

#3 lore raw
In reply to Steve French
Quoted 7 lines · Steve French
Quoted 4 lines · Stephan von Krawczynski

during tests with latest SuSE distro 8.2 compiling 2.4.21-pre6 showed a lot of
"comparison between signed and unsigned" warnings. It looks like SuSE ships gcc

Quoted 5 lines

I also noticed lots of compiler warnings with gcc 3.3, now default in SuSE, and cleaned up most of them for the cifs vfs but there are a few that just
look wrong for gcc to spit out warnings on. For example the following
local variable definition and the similar ones in the same file (fs/cifs/inode.c):

Did you try with a release version of gcc 3.3? The one shipped on SuSE Linux 8.2 media/FTP is a pre-release version.

(If SuSE would only ship patch-level updates to such essential components, say, 3.2.2 for 8.1 and the released 3.3 for 8.2.)

Signature · 1 line
Matthias Andree
#2 lore raw
In reply to Richard B. Johnson
Quoted 19 lines · Richard B. Johnson
Quoted 11 lines · Steve French
Quoted 2 lines · Stephan von Krawczynski

during tests with latest SuSE distro 8.2 compiling 2.4.21-pre6 showed a lot of "comparison between signed and unsigned" warnings. It looks like SuSE ships gcc

I also noticed lots of compiler warnings with gcc 3.3, now default in SuSE, and cleaned up most of them for the cifs vfs but there are a few that just
look wrong for gcc to spit out warnings on. For example the following
local variable definition and the similar ones in the same file (fs/cifs/inode.c):

Quoted 6 lines
	__u64 uid = 0xFFFFFFFFFFFFFFFF;

generates a warning saying the value is too long for a long on x86 SuSE 8.2 with gcc 3.3 - which makes no sense. Any value above 0xFFFFFFFFF generates the same warning (intuitively 36 bits should fit in an unsigned 64 bit local variable).

Quoted 9 lines

[SNIPPED...]

I think the compiler doesn't have a default type for something that long. Therefore you have to define is as:

__u64 uid = 0xFFFFFFFFFFFFFFFFULL;

Seems dumb, but it even works.

FYI some Spanish-language mailer is set up for an automatic response. Please don't auto-respond to a mail-list!

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.

#4 lore raw
In reply to Steve French

Steve French <[email protected]> writes:

|> I also noticed lots of compiler warnings with gcc 3.3, now default in
|> SuSE, and cleaned up most of them for the cifs vfs but there are a few
|> that just
|> look wrong for gcc to spit out warnings on.   For example the following
|> local variable definition and the similar ones in the same file
|> (fs/cifs/inode.c):
|> 
|> 	__u64 uid = 0xFFFFFFFFFFFFFFFF;
|> 
|> generates a warning saying the value is too long for a long on x86 SuSE
|> 8.2 with gcc 3.3 - which makes no sense.  Any value
|> above 0xFFFFFFFFF generates the same warning (intuitively
|> 36 bits should fit in an unsigned 64 bit local variable).

An expression is evaluated independent of the context, ie. the fact that the left side of the assignment is a 64 bit variable has no significance at all. But I agree that the warning should only occur in c89 mode, not in the default gnu89 mode, where long long is available. And in fact the generated code will be correct.

|> Defining the literal with the UL suffix didn't seem to help

Yes, since you need a long long literal.

|> rebelled against the solutions that work for this case ie casting the
|> local variable which is already __u64 to __u64 but that presumably would
|> work for those three, as would a (__u64)cast of -1 which seems equally
|> ugly).

You can just use -1. The implicit conversion to __u64 will DTRT.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."