Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 80816 - gcc 3.4.3.20050110 integer overflow
Summary: gcc 3.4.3.20050110 integer overflow
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: Low minor (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-04 19:02 UTC by Gavin
Modified: 2005-07-14 02:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin 2005-02-04 19:02:49 UTC
When adjusting the "tuning knobs" of the Linux 2.6.10 scheduler (kernel/sched.c), if the default timeslice is set higher than ~210 milliseconds, gcc dies with an "integer overflow in expression".

The problem can be isolated into an elementary program:
# gcc -Wall jo.c
jo.c: In function `main':
jo.c:5: warning: integer overflow in expression
# cat jo.c
#include <stdio.h>

int main()
{
        unsigned long long i = (3000 * 1000000000);
        printf("i=%Lu\n", i);
        return 0;
}

I'm not actively tracking gcc 4 development, so perhaps gcc 3.4.3's troubles with integer math involving values > 2G are old news?

I'm in a hurry and worked around the problem by providing hard coded constants in octal, but I'd prefer gcc to just do the "right" thing.

I didn't see any gcc options to enable support for integer arithmetic > 2GB.  Maybe this is just a missing feature instead of a bug?  Thoughts?
Comment 1 SpanKY gentoo-dev 2005-02-06 04:09:32 UTC
does it work with gcc-3.4.3-r1 ?
Comment 2 Gavin 2005-02-06 10:42:12 UTC
> does it work with gcc-3.4.3-r1 ?

Sorry .. I don't have an install of that version anymore.

The test program I supplied is 8 lines long, so maybe someone else with gcc-3.4.3-r1 could test?

Perhaps this will help?
#/usr/lib/gcc-lib/i586-pc-linux-gnu/3.3.5/cc1 -Wall j.c
 main
jo.c: In function `main':
jo.c:5: warning: integer overflow in expression
Comment 3 Jeremy Huddleston (RETIRED) gentoo-dev 2005-02-06 13:35:51 UTC
gavin:  That looks like you're not using gcc-3.4.3.20050110.  What's the output of 'gcc-config -l'?  Try switching to 3.4.3.20050110.
Comment 4 Gavin 2005-02-07 17:35:36 UTC
Sorry, it seems my last post was too brief.

I filed a bug based on the behavior of gcc 3.4.3.20050110 (latest ebuild marked stable). You asked me to test gcc-3.4.3-r1, but I don't have easy access to that version, so I provided a second test using a different version of gcc (3.3.5) that I do have easy access to (same system).

The first test was performed using the plain "i586-pc-linux-gnu-3.4.3" gcc specs (according to "gcc-config -l").
Comment 5 Jeremy Huddleston (RETIRED) gentoo-dev 2005-07-14 02:37:43 UTC
Try 3.4.4.  If it doesn't work there, I'd file a bug upstream.  This isn't the
kind of thing I really care to tackle ;)