public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/55743] New: limits.h included unnecessarily in libgcc2.c - can break --without-headers bootstrap
@ 2012-12-19 17:50 wookey at wookware dot org
  2012-12-19 17:54 ` [Bug libgcc/55743] " wookey at wookware dot org
  2013-10-07  8:47 ` rearnsha at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: wookey at wookware dot org @ 2012-12-19 17:50 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55743

             Bug #: 55743
           Summary: limits.h included unnecessarily in libgcc2.c - can
                    break --without-headers bootstrap
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wookey@wookware.org


The offending code is three very similar function in libgcc2.c around 1733:
#if defined(L_fixunsxfsi) && LIBGCC2_HAS_XF_MODE
/* 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://repo.or.cz/w/official-gcc.git/blobdiff/49f0f270673c4512c11f72a038b84c321ae5534a..7429c938827aa98bf3b02c4ac89510f4d28ef0b1:/gcc/libgcc2.c)
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.

And having it there can cause problems because if this file is built during a
stage1 bootstrap configured with --without-headers (before glibc headers are
available), then the include finds limits.h in the includes-fixed dir and thus
limits.h on the build machine (via #include_next) (which tries to bring in
bits/predefs.h of the wrong architecture), or at least it does in the
Debian/Ubuntu toolchain packaging. This is no doubt wrong too, and other
changes should probably be made, but simply removing the unnecessary limits.h
including fixes the issue for me and seems correct.

Distro-specific details are given in bugs
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696267 and
https://bugs.launchpad.net/debian/+source/gcc-4.7/+bug/1091823

The patch was generated against 4.7.2 but the issue is still present in trunk.


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

* [Bug libgcc/55743] limits.h included unnecessarily in libgcc2.c - can break --without-headers bootstrap
  2012-12-19 17:50 [Bug libgcc/55743] New: limits.h included unnecessarily in libgcc2.c - can break --without-headers bootstrap wookey at wookware dot org
@ 2012-12-19 17:54 ` wookey at wookware dot org
  2013-10-07  8:47 ` rearnsha at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: wookey at wookware dot org @ 2012-12-19 17:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55743

--- Comment #1 from Wookey <wookey at wookware dot org> 2012-12-19 17:54:16 UTC ---
Created attachment 29008
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29008
Remove unnecessary limits.h references in libgcc2.c


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

* [Bug libgcc/55743] limits.h included unnecessarily in libgcc2.c - can break --without-headers bootstrap
  2012-12-19 17:50 [Bug libgcc/55743] New: limits.h included unnecessarily in libgcc2.c - can break --without-headers bootstrap wookey at wookware dot org
  2012-12-19 17:54 ` [Bug libgcc/55743] " wookey at wookware dot org
@ 2013-10-07  8:47 ` rearnsha at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2013-10-07  8:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55743

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Fixed with:

http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00828.html


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

end of thread, other threads:[~2013-10-07  8:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-19 17:50 [Bug libgcc/55743] New: limits.h included unnecessarily in libgcc2.c - can break --without-headers bootstrap wookey at wookware dot org
2012-12-19 17:54 ` [Bug libgcc/55743] " wookey at wookware dot org
2013-10-07  8:47 ` rearnsha at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).