public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
@ 2011-05-06  2:41 hp at gcc dot gnu.org
  2011-05-06  3:03 ` [Bug middle-end/48908] " hp at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: hp at gcc dot gnu.org @ 2011-05-06  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.7 Regression]: build fails on cris-elf in
                    libiberty:md5.c, shift-related
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: build, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hp@gcc.gnu.org
                CC: rguenth@gcc.gnu.org
              Host: x86_64-unknown-linux-gnu
            Target: cris-axis-elf


Created attachment 24198
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24198
"cc1 -fpreprocessed md5.i -O2 -o md5.s" to repeat

A patch in the revision range (last_known_working:first_known_failing)
173419:173428 caused the build for cris-elf to fail as follows:

/tmp/hpautotest-gcc1/cris-elf/gccobj/./gcc/xgcc
-B/tmp/hpautotest-gcc1/cris-elf/gccobj/./gcc/ -nostdinc
-B/tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/newlib/ -isystem
/tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/newlib/targ-include -isystem
/tmp/hpautotest-gcc1/gcc/newlib/libc/include
-B/tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/libgloss/cris
-L/tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/libgloss/libnosys
-L/tmp/hpautotest-gcc1/gcc/libgloss/cris
-B/tmp/hpautotest-gcc1/cris-elf/pre/cris-elf/bin/
-B/tmp/hpautotest-gcc1/cris-elf/pre/cris-elf/lib/ -isystem
/tmp/hpautotest-gcc1/cris-elf/pre/cris-elf/include -isystem
/tmp/hpautotest-gcc1/cris-elf/pre/cris-elf/sys-include    -c -DHAVE_CONFIG_H -g
-O2  -I. -I/tmp/hpautotest-gcc1/gcc/libiberty/../include  -W -Wall
-Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic 
/tmp/hpautotest-gcc1/gcc/libiberty/md5.c -o md5.o
/tmp/hpautotest-gcc1/gcc/libiberty/md5.c: In function 'md5_finish_ctx':
/tmp/hpautotest-gcc1/gcc/libiberty/md5.c:113:3: warning: dereferencing
type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
/tmp/hpautotest-gcc1/gcc/libiberty/md5.c:114:3: warning: dereferencing
type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
/tmp/hpautotest-gcc1/gcc/libiberty/md5.c: In function 'md5_process_block':
/tmp/hpautotest-gcc1/gcc/libiberty/md5.c:327:7: internal compiler error:
Segmentation fault

A gdb backtrace points at revision 173428:

(The revision below was 173446)
(gdb) r -fpreprocessed /n/slask/hp_tmp/md5.i -O2 -o md5.s
Starting program: /tmp/hpautotest-gcc1/cris-elf/gccobj/gcc/cc1 -fpreprocessed
/n/slask/hp_tmp/md5.i -O2 -o md5.s
 md5_process_block
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <early_local_cleanups> <emutls> <whole-program>
<ipa-profile> <cp> <inline> <pure-const> <static-var>Assembling functions:
 md5_process_block
Program received signal SIGSEGV, Segmentation fault.
0x00000000006c3595 in copy_to_mode_reg (mode=SImode, x=0x0) at
/tmp/hpautotest-gcc1/gcc/gcc/explow.c:635
635       gcc_assert (GET_MODE (x) == mode || GET_MODE (x) == VOIDmode);
Missing separate debuginfos, use: debuginfo-install glibc-2.11.1-1.x86_64
(gdb) p x
$1 = (rtx) 0x0
(gdb) bt
#0  0x00000000006c3595 in copy_to_mode_reg (mode=SImode, x=0x0) at
/tmp/hpautotest-gcc1/gcc/gcc/explow.c:635
#1  0x0000000000929f18 in maybe_legitimize_operand (icode=CODE_FOR_lshrsi3,
opno=2, op=0x7fffffffcb60)
    at /tmp/hpautotest-gcc1/gcc/gcc/optabs.c:7077
#2  0x000000000092a227 in maybe_legitimize_operands (icode=CODE_FOR_lshrsi3,
opno=0, nops=3, ops=0x7fffffffcb40)
    at /tmp/hpautotest-gcc1/gcc/gcc/optabs.c:7139
#3  0x000000000092a2b1 in maybe_gen_insn (icode=CODE_FOR_lshrsi3, nops=3,
ops=0x7fffffffcb40)
    at /tmp/hpautotest-gcc1/gcc/gcc/optabs.c:7157
#4  0x000000000091b792 in expand_binop_directly (mode=SImode,
binoptab=0x13b7cb8, op0=0x7ffff7cb3ce0, 
    op1=0x7ffff7eb1e10, target=0x7ffff7cb3d00, unsignedp=1,
methods=OPTAB_DIRECT, last=0x7ffff7e0eee8)
    at /tmp/hpautotest-gcc1/gcc/gcc/optabs.c:1328
#5  0x000000000091b9c2 in expand_binop (mode=SImode, binoptab=0x13b7cb8,
op0=0x7ffff7cb3ce0, op1=0x7ffff7eb1e10, 
    target=0x7ffff7cb3d00, unsignedp=1, methods=OPTAB_DIRECT) at
/tmp/hpautotest-gcc1/gcc/gcc/optabs.c:1394
#6  0x00000000006ca8f0 in expand_shift_1 (code=RSHIFT_EXPR, mode=SImode,
shifted=0x7ffff7cb3ce0, 
    amount=0x7ffff7eb1e10, target=0x7ffff7cb3d00, unsignedp=1) at
/tmp/hpautotest-gcc1/gcc/gcc/expmed.c:2166
#7  0x00000000006ca80f in expand_shift_1 (code=LROTATE_EXPR, mode=SImode,
shifted=0x7ffff7cb3ce0, 
    amount=0x7ffff7eca4e0, target=0x7ffff7cb3d00, unsignedp=1) at
/tmp/hpautotest-gcc1/gcc/gcc/expmed.c:2154
#8  0x00000000006caa77 in expand_variable_shift (code=LROTATE_EXPR,
mode=SImode, shifted=0x7ffff7cb3ce0, 
    amount=0x7ffff7f95640, target=0x7ffff7cb3d00, unsignedp=1) at
/tmp/hpautotest-gcc1/gcc/gcc/expmed.c:2226
#9  0x00000000006fb2c7 in expand_expr_real_2 (ops=0x7fffffffd860,
target=0x7ffff7cb3d00, tmode=SImode, 
    modifier=EXPAND_NORMAL) at /tmp/hpautotest-gcc1/gcc/gcc/expr.c:8062
#10 0x00000000005ec099 in expand_gimple_stmt_1 (stmt=0x7ffff7fbf5d8) at
/tmp/hpautotest-gcc1/gcc/gcc/cfgexpand.c:1989
#11 0x00000000005ec301 in expand_gimple_stmt (stmt=0x7ffff7fbf5d8) at
/tmp/hpautotest-gcc1/gcc/gcc/cfgexpand.c:2050
#12 0x00000000005f51ad in expand_gimple_basic_block (bb=0x7ffff7f93a28)
    at /tmp/hpautotest-gcc1/gcc/gcc/cfgexpand.c:3619
#13 0x00000000005f6ee0 in gimple_expand_cfg () at
/tmp/hpautotest-gcc1/gcc/gcc/cfgexpand.c:4102
#14 0x000000000093c717 in execute_one_pass (pass=0x138e8e0) at
/tmp/hpautotest-gcc1/gcc/gcc/passes.c:1556
#15 0x000000000093c906 in execute_pass_list (pass=0x138e8e0) at
/tmp/hpautotest-gcc1/gcc/gcc/passes.c:1611
#16 0x0000000000ab11c8 in tree_rest_of_compilation (fndecl=0x7ffff7f97500)
    at /tmp/hpautotest-gcc1/gcc/gcc/tree-optimize.c:417
#17 0x0000000000d3e6cf in cgraph_expand_function (node=0x7ffff7fc0000)
    at /tmp/hpautotest-gcc1/gcc/gcc/cgraphunit.c:1579
#18 0x0000000000d3e88e in cgraph_expand_all_functions () at
/tmp/hpautotest-gcc1/gcc/gcc/cgraphunit.c:1638
#19 0x0000000000d3ef1b in cgraph_optimize () at
/tmp/hpautotest-gcc1/gcc/gcc/cgraphunit.c:1901
#20 0x0000000000d3c2c5 in cgraph_finalize_compilation_unit () at
/tmp/hpautotest-gcc1/gcc/gcc/cgraphunit.c:1099
#21 0x000000000049240d in c_write_global_declarations () at
/tmp/hpautotest-gcc1/gcc/gcc/c-decl.c:9846
#22 0x0000000000a1404c in compile_file () at
/tmp/hpautotest-gcc1/gcc/gcc/toplev.c:586
#23 0x0000000000a161a8 in do_compile () at
/tmp/hpautotest-gcc1/gcc/gcc/toplev.c:1928
#24 0x0000000000a16315 in toplev_main (argc=6, argv=0x7fffffffe128) at
/tmp/hpautotest-gcc1/gcc/gcc/toplev.c:2000
#25 0x0000000000556460 in main (argc=6, argv=0x7fffffffe128) at
/tmp/hpautotest-gcc1/gcc/gcc/main.c:36
(gdb) up
#1  0x0000000000929f18 in maybe_legitimize_operand (icode=CODE_FOR_lshrsi3,
opno=2, op=0x7fffffffcb60)
    at /tmp/hpautotest-gcc1/gcc/gcc/optabs.c:7077
7077          op->value = copy_to_mode_reg (mode, op->value);
(gdb) p *op
$1 = {type = EXPAND_INPUT, unsigned_p = 0, unused = 0, mode = SImode, value =
0x7ffff7eb1e10}
(gdb) p op->value
$2 = (rtx) 0x7ffff7eb1e10
(gdb) pr
(minus (const_int 32 [0x20])
    (const_int 7 [0x7]))
(gdb) 

Author of the most suspect patch in revision range CC:ed.
See also the preprocessed test-case.


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

* [Bug middle-end/48908] [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
  2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
@ 2011-05-06  3:03 ` hp at gcc dot gnu.org
  2011-05-06  4:18 ` kkojima at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hp at gcc dot gnu.org @ 2011-05-06  3:03 UTC (permalink / raw)
  To: gcc-bugs

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

Hans-Peter Nilsson <hp at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.06 03:01:28
     Ever Confirmed|0                           |1

--- Comment #1 from Hans-Peter Nilsson <hp at gcc dot gnu.org> 2011-05-06 03:01:28 UTC ---
Yep, build works for 173427.


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

* [Bug middle-end/48908] [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
  2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
  2011-05-06  3:03 ` [Bug middle-end/48908] " hp at gcc dot gnu.org
@ 2011-05-06  4:18 ` kkojima at gcc dot gnu.org
  2011-05-06  8:56 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-05-06  4:18 UTC (permalink / raw)
  To: gcc-bugs

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

Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kkojima at gcc dot gnu.org

--- Comment #2 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-05-06 03:59:30 UTC ---
I see the same failure on sh4-unknown-linux-gnu.


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

* [Bug middle-end/48908] [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
  2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
  2011-05-06  3:03 ` [Bug middle-end/48908] " hp at gcc dot gnu.org
  2011-05-06  4:18 ` kkojima at gcc dot gnu.org
@ 2011-05-06  8:56 ` rguenth at gcc dot gnu.org
  2011-05-06  9:22 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-06  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Target Milestone|---                         |4.7.0

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-06 08:47:48 UTC ---
Investigating.


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

* [Bug middle-end/48908] [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
  2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-05-06  8:56 ` rguenth at gcc dot gnu.org
@ 2011-05-06  9:22 ` rguenth at gcc dot gnu.org
  2011-05-06 23:34 ` kkojima at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-06  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-06 09:19:38 UTC ---
Ok, so

              other_amount
                = simplify_gen_binary (MINUS, GET_MODE (op1),
                                       GEN_INT (GET_MODE_BITSIZE (mode)),
                                       op1);

does not constant fold!?  Oh.

The following fixes the ICE for me:

Index: expmed.c
===================================================================
--- expmed.c    (revision 173473)
+++ expmed.c    (working copy)
@@ -2141,9 +2141,12 @@ expand_shift_1 (enum tree_code code, enu
              rtx new_amount, other_amount;
              rtx temp1;

+             op1_mode = GET_MODE (op1);
+             if (op1_mode == VOIDmode)
+               op1_mode = word_mode;
              new_amount = op1;
              other_amount
-               = simplify_gen_binary (MINUS, GET_MODE (op1),
+               = simplify_gen_binary (MINUS, op1_mode,
                                       GEN_INT (GET_MODE_BITSIZE (mode)),
                                       op1);

or, other variant, side-stepping the issue:

Index: expmed.c
===================================================================
--- expmed.c    (revision 173473)
+++ expmed.c    (working copy)
@@ -2141,11 +2141,16 @@ expand_shift_1 (enum tree_code code, enu
              rtx new_amount, other_amount;
              rtx temp1;

+             op1_mode = GET_MODE (op1);
              new_amount = op1;
-             other_amount
-               = simplify_gen_binary (MINUS, GET_MODE (op1),
-                                      GEN_INT (GET_MODE_BITSIZE (mode)),
-                                      op1);
+             if (op1_mode == VOIDmode)
+               other_amount = GEN_INT (GET_MODE_BITSIZE (mode)
+                                       - INTVAL (op1));
+             else
+               other_amount
+                 = simplify_gen_binary (MINUS, op1_mode,
+                                        GEN_INT (GET_MODE_BITSIZE (mode)),
+                                        op1);

              shifted = force_reg (mode, shifted);


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

* [Bug middle-end/48908] [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
  2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-05-06  9:22 ` rguenth at gcc dot gnu.org
@ 2011-05-06 23:34 ` kkojima at gcc dot gnu.org
  2011-05-08 15:25 ` michael.a.richmond at nasa dot gov
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu.org @ 2011-05-06 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-05-06 23:14:30 UTC ---
I've tried the second patch with r173466.  It fixes the build failure
for sh4-unknown-linux-gnu and there are no new test failures from r173407
on that target.


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

* [Bug middle-end/48908] [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
  2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-05-06 23:34 ` kkojima at gcc dot gnu.org
@ 2011-05-08 15:25 ` michael.a.richmond at nasa dot gov
  2011-05-08 15:55 ` rguenth at gcc dot gnu.org
  2011-05-08 16:23 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: michael.a.richmond at nasa dot gov @ 2011-05-08 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

Michael Richmond <michael.a.richmond at nasa dot gov> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michael.a.richmond at nasa
                   |                            |dot gov

--- Comment #6 from Michael Richmond <michael.a.richmond at nasa dot gov> 2011-05-08 15:10:57 UTC ---
I encountered the same bug in the gcc-4.7-20110507 snapshot under
sparc-unknown-linux-gnu. The expmed.c patches in Comment 4 appear to be
incompatible with this snapshot.


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

* [Bug middle-end/48908] [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
  2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-05-08 15:25 ` michael.a.richmond at nasa dot gov
@ 2011-05-08 15:55 ` rguenth at gcc dot gnu.org
  2011-05-08 16:23 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-08 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-08 15:46:30 UTC ---
Fixed.


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

* [Bug middle-end/48908] [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related
  2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-05-08 15:55 ` rguenth at gcc dot gnu.org
@ 2011-05-08 16:23 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-08 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-08 15:46:09 UTC ---
Author: rguenth
Date: Sun May  8 15:46:06 2011
New Revision: 173550

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173550
Log:
2011-05-08  Richard Guenther  <rguenther@suse.de>

    PR middle-end/48908
    PR middle-end/48905
    * expmed.c (expand_shift_1): Compute adjusted constant shift
    amount manually.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expmed.c


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

end of thread, other threads:[~2011-05-08 16:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-06  2:41 [Bug middle-end/48908] New: [4.7 Regression]: build fails on cris-elf in libiberty:md5.c, shift-related hp at gcc dot gnu.org
2011-05-06  3:03 ` [Bug middle-end/48908] " hp at gcc dot gnu.org
2011-05-06  4:18 ` kkojima at gcc dot gnu.org
2011-05-06  8:56 ` rguenth at gcc dot gnu.org
2011-05-06  9:22 ` rguenth at gcc dot gnu.org
2011-05-06 23:34 ` kkojima at gcc dot gnu.org
2011-05-08 15:25 ` michael.a.richmond at nasa dot gov
2011-05-08 15:55 ` rguenth at gcc dot gnu.org
2011-05-08 16:23 ` rguenth 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).