public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/57266] New: [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap
@ 2013-05-13 21:13 mikpe at it dot uu.se
  2013-05-13 21:48 ` [Bug bootstrap/57266] " glisse at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mikpe at it dot uu.se @ 2013-05-13 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57266
           Summary: [4.9 regression] comparison between signed and
                    unsigned integer expressions in fold_binary_loc breaks
                    m68k bootstrap
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikpe at it dot uu.se

Attempting to bootstrap gcc-4.9-20130512 on m68k-linux fails with:

/mnt/scratch/objdir49/./prev-gcc/xg++ -B/mnt/scratch/objdir49/./prev-gcc/
-B/mnt/scratch/install49/m68k-unknown-linux-gnu/bin/ -nostdinc++
-B/mnt/scratch/objdir49/prev-m68k-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/mnt/scratch/objdir49/prev-m68k-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
-I/mnt/scratch/objdir49/prev-m68k-unknown-linux-gnu/libstdc++-v3/include/m68k-unknown-linux-gnu
-I/mnt/scratch/objdir49/prev-m68k-unknown-linux-gnu/libstdc++-v3/include
-I/mnt/scratch/gcc-4.9-20130512/libstdc++-v3/libsupc++
-L/mnt/scratch/objdir49/prev-m68k-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/mnt/scratch/objdir49/prev-m68k-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
-c   -g -O2 -gtoggle -DIN_GCC   -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings -Werror   -DHAVE_CONFIG_H -I. -I.
-I/mnt/scratch/gcc-4.9-20130512/gcc -I/mnt/scratch/gcc-4.9-20130512/gcc/.
-I/mnt/scratch/gcc-4.9-20130512/gcc/../include
-I/mnt/scratch/gcc-4.9-20130512/gcc/../libcpp/include 
-I/mnt/scratch/gcc-4.9-20130512/gcc/../libdecnumber
-I/mnt/scratch/gcc-4.9-20130512/gcc/../libdecnumber/dpd -I../libdecnumber
-I/mnt/scratch/gcc-4.9-20130512/gcc/../libbacktrace   
/mnt/scratch/gcc-4.9-20130512/gcc/fold-const.c -o fold-const.o
/mnt/scratch/gcc-4.9-20130512/gcc/fold-const.c: In function 'tree_node*
fold_binary_loc(location_t, tree_code, tree, tree, tree)':
/mnt/scratch/gcc-4.9-20130512/gcc/fold-const.c:12430:15: error: comparison
between signed and unsigned integer expressions [-Werror=sign-compare]
    if (low >= prec)
               ^
cc1plus: all warnings being treated as errors
make[3]: *** [fold-const.o] Error 1
make[3]: Leaving directory `/mnt/scratch/objdir49/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/mnt/scratch/objdir49'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/mnt/scratch/objdir49'
make: *** [bootstrap] Error 2

At this point in the source, 'low' is of type HOST_WIDE_INT which is 'long' (32
bits on m68k) while 'prec' is of type 'unsigned int' (also 32 bits).

Caused by r198772.  Before that the code compared 'low' with TYPE_PRECISION (),
which is a smaller-than-int unsigned bitfield, so presumably promoted to int.
Casting prec to HOST_WIDE_INT here seems to work.


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

* [Bug bootstrap/57266] [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap
  2013-05-13 21:13 [Bug bootstrap/57266] New: [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap mikpe at it dot uu.se
@ 2013-05-13 21:48 ` glisse at gcc dot gnu.org
  2013-05-14  6:19 ` glisse at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-05-13 21:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Ah, sorry. I already had to play a bit with types to avoid similar painful
warnings on x86_64 and didn't check on other platforms. I think making "low" an
unsigned int would be fine (we have just checked that it is the sum of 2
numbers smaller than a precision). Note that the host_integerp checks are
suspicious, I would have expected true as second argument, especially for the
second one, to ensure it is not negative.


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

* [Bug bootstrap/57266] [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap
  2013-05-13 21:13 [Bug bootstrap/57266] New: [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap mikpe at it dot uu.se
  2013-05-13 21:48 ` [Bug bootstrap/57266] " glisse at gcc dot gnu.org
@ 2013-05-14  6:19 ` glisse at gcc dot gnu.org
  2013-05-14  9:56 ` rguenth at gcc dot gnu.org
  2013-05-16 21:54 ` glisse at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-05-14  6:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Created attachment 30108
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30108&action=edit
patch

This passed bootstrap+testsuite on x86_64-linux-gnu. Is it enough to fix
bootstrap for you?


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

* [Bug bootstrap/57266] [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap
  2013-05-13 21:13 [Bug bootstrap/57266] New: [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap mikpe at it dot uu.se
  2013-05-13 21:48 ` [Bug bootstrap/57266] " glisse at gcc dot gnu.org
  2013-05-14  6:19 ` glisse at gcc dot gnu.org
@ 2013-05-14  9:56 ` rguenth at gcc dot gnu.org
  2013-05-16 21:54 ` glisse at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-05-14  9:56 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0


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

* [Bug bootstrap/57266] [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap
  2013-05-13 21:13 [Bug bootstrap/57266] New: [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap mikpe at it dot uu.se
                   ` (2 preceding siblings ...)
  2013-05-14  9:56 ` rguenth at gcc dot gnu.org
@ 2013-05-16 21:54 ` glisse at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-05-16 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
r198880 | glisse | 2013-05-14 14:06:27 +0200 (Tue, 14 May 2013) | 8 lines

2013-05-14  Marc Glisse  <marc.glisse@inria.fr>

        PR bootstrap/57266
        * fold-const.c (fold_binary_loc) <shift>: Use an unsigned
        variable for the shift amount. Check that we shift by non-negative
        amounts.


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

end of thread, other threads:[~2013-05-16 21:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-13 21:13 [Bug bootstrap/57266] New: [4.9 regression] comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap mikpe at it dot uu.se
2013-05-13 21:48 ` [Bug bootstrap/57266] " glisse at gcc dot gnu.org
2013-05-14  6:19 ` glisse at gcc dot gnu.org
2013-05-14  9:56 ` rguenth at gcc dot gnu.org
2013-05-16 21:54 ` glisse 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).