libgcc2.c includes limits.h without need
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro AArch64 cross-distro work |
Fix Released
|
Medium
|
Unassigned | ||
Linaro GCC |
Fix Released
|
Undecided
|
Unassigned | ||
gcc-4.7 (Debian) |
Fix Released
|
Unknown
|
|||
gcc-4.7 (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned | ||
gcc-4.8 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
gcc stage1 build configured with --without headers fails during (static) libgcc build due to including limits.h, which is only present in build arch versions at this point. This only seems to actually crop up in the Debian/Ubuntu packaging, probably because of multiarch file layouts. (The build completes if any version of bits/predefs.h is found anywhere, such as /usr/include, which will normally be the case on a mahcine with libc6-dev installed -that it is for the wrong arch doesn't actually seem to matter in this case).
The error is:
/home/wookey/
In file included from /usr/include/
/usr/include/
Including headers when --without-headers is set should be wrong. Including wrong-arch headers is also wrong. Things could (and possibly should) probably be done to fix that, but in fact it's not actually necessary:
The offending code is in libgcc2.c around 1733:
#if defined(
/* Reenable the normal types, in case limits.h needs them. */
#undef char
#undef short
#undef int
#undef long
#undef unsigned
#undef float
#undef double
#undef MIN
#undef MAX
#include <limits.h>
UWtype
__fixunsxfSI (XFtype a)
{
if (a >= - (DFtype) Wtype_MIN)
return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
return (Wtype) a;
}
#endif
That inclusion of limits.h was there because the function __fixunsxfSI used to use LONG_MIN from that headers file, but this was changed a while back (http://
to use Wtype_MIN instead, which is defined in the local libgcc2.h header.
so in fact the limits.h inclusion is no longer needed.
The attached patch fixes this for gcc 4.7.2
Changed in gcc-4.7 (Debian): | |
status: | Unknown → Confirmed |
Changed in linaro-aarch64: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in gcc-4.7 (Debian): | |
status: | Confirmed → Fix Released |
Changed in gcc-linaro: | |
status: | New → Confirmed |
Changed in gcc-linaro: | |
status: | Confirmed → Fix Released |
Here is a patch to fix this for gcc-4.7 in raring.