public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/45871] New: lto bootstrap miscompiles expmed.c1
@ 2010-10-03 14:36 andi-gcc at firstfloor dot org
  2010-10-03 19:42 ` [Bug middle-end/45871] [4.6 Regression] lto bootstrap miscompiles expmed.c rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: andi-gcc at firstfloor dot org @ 2010-10-03 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: lto bootstrap miscompiles expmed.c1
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: andi-gcc@firstfloor.org


On x86_64-linux:

Doing a lto bootstrap (BUILD_CONFIG=bootstrap-lto) with current trunk
(last change 2010-10-03  Uros Bizjak  <ubizjak@gmail.com>) 
ends with ICEs (for each file tried) on the compilation of 
the 32bit libgcc2 in stage2.

It looks like expmed.c is miscompiled for the stage1 compiler and 
jumps to a hardcoded NULL:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00000000009b788b in store_bit_field_1 (str_rtx=<value optimized out>,
bitsize=15, bitnum=112, fieldmode=VOIDmode, 
    value=<value optimized out>, fallback_p=1 '\001') at
../../gcc/gcc/expmed.c:657
#2  0x00000000009b809f in store_bit_field (str_rtx=<value optimized out>,
bitsize=<value optimized out>, 
    bitnum=<value optimized out>, fieldmode=<value optimized out>, value=<value
optimized out>) at ../../gcc/gcc/expmed.c:833
#3  0x0000000000772ffe in store_field (target=0x7ffff6a37378, bitsize=15,
bitpos=112, mode=VOIDmode, 
    exp=<value optimized out>, type=<value optimized out>, alias_set=0,
nontemporal=0 '\000') at ../../gcc/gcc/expr.c:5969
#4  store_field (target=0x7ffff6a37378, bitsize=15, bitpos=112, mode=VOIDmode,
exp=<value optimized out>, 
    type=<value optimized out>, alias_set=0, nontemporal=0 '\000') at
../../gcc/gcc/expr.c:5820
#5  0x0000000000773b5a in expand_assignment (to=0x7ffff6d78600,
from=0x7ffff68eee18, nontemporal=0 '\000')
    at ../../gcc/gcc/expr.c:4352
#6  expand_assignment (to=0x7ffff6d78600, from=0x7ffff68eee18, nontemporal=0
'\000') at ../../gcc/gcc/expr.c:4150
#7  0x00000000008ce344 in expand_gimple_stmt_1 (stmt=0x7ffff6bcb4b0) at
../../gcc/gcc/cfgexpand.c:1892
#8  expand_gimple_stmt (stmt=0x7ffff6bcb4b0) at ../../gcc/gcc/cfgexpand.c:2001
#9  0x00000000008ceda6 in expand_gimple_basic_block (bb=0x7ffff6be2b60) at
../../gcc/gcc/cfgexpand.c:3453
#10 0x00000000008d2842 in gimple_expand_cfg () at
../../gcc/gcc/cfgexpand.c:3913
#11 0x0000000000b528bf in execute_one_pass (pass=0xf3ab40) at
../../gcc/gcc/passes.c:1569
#12 0x0000000000b52c95 in execute_pass_list (pass=0xf3ab40) at
../../gcc/gcc/passes.c:1624
#13 0x0000000000c0c624 in tree_rest_of_compilation (fndecl=0x7ffff6cd6c00) at
../../gcc/gcc/tree-optimize.c:419
#14 0x0000000000aeca86 in cgraph_expand_function (node=0x7ffff6d11160) at
../../gcc/gcc/cgraphunit.c:1477
#15 0x0000000000aedfa2 in cgraph_expand_all_functions () at
../../gcc/gcc/cgraphunit.c:1556
#16 cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1812
#17 cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1743
#18 0x0000000000aee83a in cgraph_finalize_compilation_unit () at
../../gcc/gcc/cgraphunit.c:1020
#19 0x0000000000793803 in c_write_global_declarations () at
../../gcc/gcc/c-decl.c:9747
#20 c_write_global_declarations () at ../../gcc/gcc/c-decl.c:9701
#21 0x0000000000b8807c in compile_file (argc=83, argv=0x7fffffffdb98) at
../../gcc/gcc/toplev.c:951
#22 do_compile (argc=83, argv=0x7fffffffdb98) at ../../gcc/gcc/toplev.c:2379
#23 toplev_main (argc=83, argv=0x7fffffffdb98) at ../../gcc/gcc/toplev.c:2420
(gdb) up
#1  0x00000000009b788b in store_bit_field_1 (str_rtx=<value optimized out>,
bitsize=15, bitnum=112, fieldmode=VOIDmode, 
    value=<value optimized out>, fallback_p=1 '\001') at
../../gcc/gcc/expmed.c:657
657           && insn_data[CODE_FOR_insv].operand[1].predicate (GEN_INT
(bitsize),
(gdb) l
652           && GET_MODE (value) != BLKmode
653           && bitsize > 0
654           && GET_MODE_BITSIZE (op_mode) >= bitsize
655           && ! ((REG_P (op0) || GET_CODE (op0) == SUBREG)
656                 && (bitsize + bitpos > GET_MODE_BITSIZE (op_mode)))
657           && insn_data[CODE_FOR_insv].operand[1].predicate (GEN_INT
(bitsize),
658                                                             VOIDmode)
659           && check_predicate_volatile_ok (CODE_FOR_insv, 0, op0, VOIDmode))
660         {
661           int xbitpos = bitpos;


Stepping through it: 

It enters the predicate gen_rtx_CONST_INT and returns and then runs 
into a hardcoded NULL jump in store_bit_field_1:

(gdb) 
0x00000000009df018 in gen_rtx_CONST_INT (mode=<value optimized out>, arg=15) at
../../gcc/gcc/emit-rtl.c:422
422     }
2: x/3i $pc
=> 0x9df018 <gen_rtx_CONST_INT+56>:     retq   
   0x9df019 <gen_rtx_CONST_INT+57>:     nopl   0x0(%rax)
   0x9df020 <gen_rtx_CONST_INT+64>:     mov    0x65c431(%rip),%rdi        #
0x103b458 <const_int_htab.997056>
(gdb) 
0x00000000009b7882 in store_bit_field_1 (str_rtx=<value optimized out>,
bitsize=15, bitnum=112, fieldmode=VOIDmode, 
    value=<value optimized out>, fallback_p=1 '\001') at
../../gcc/gcc/expmed.c:657
657           && insn_data[CODE_FOR_insv].operand[1].predicate (GEN_INT
(bitsize),
2: x/3i $pc
=> 0x9b7882 <store_bit_field_1+1570>:   xor    %esi,%esi
   0x9b7884 <store_bit_field_1+1572>:   mov    %rax,%rdi
   0x9b7887 <store_bit_field_1+1575>:   xor    %eax,%eax
(gdb) 
0x00000000009b7884      657           &&
insn_data[CODE_FOR_insv].operand[1].predicate (GEN_INT (bitsize),
2: x/3i $pc
=> 0x9b7884 <store_bit_field_1+1572>:   mov    %rax,%rdi
   0x9b7887 <store_bit_field_1+1575>:   xor    %eax,%eax
   0x9b7889 <store_bit_field_1+1577>:   callq  *%rax
(gdb) 
0x00000000009b7887      657           &&
insn_data[CODE_FOR_insv].operand[1].predicate (GEN_INT (bitsize),
2: x/3i $pc
=> 0x9b7887 <store_bit_field_1+1575>:   xor    %eax,%eax
   0x9b7889 <store_bit_field_1+1577>:   callq  *%rax
   0x9b788b <store_bit_field_1+1579>:   test   %eax,%eax

That obviously jumps to NULL.


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

* [Bug middle-end/45871] [4.6 Regression] lto bootstrap miscompiles expmed.c
  2010-10-03 14:36 [Bug middle-end/45871] New: lto bootstrap miscompiles expmed.c1 andi-gcc at firstfloor dot org
@ 2010-10-03 19:42 ` rguenth at gcc dot gnu.org
  2010-10-03 22:07 ` [Bug middle-end/45871] " hubicka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-10-03 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.03 19:42:33
                 CC|                            |hubicka at gcc dot gnu.org
   Target Milestone|---                         |4.6.0
            Summary|lto bootstrap miscompiles   |[4.6 Regression] lto
                   |expmed.c                    |bootstrap miscompiles
                   |                            |expmed.c
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-03 19:42:33 UTC ---
Confirmed.


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

* [Bug middle-end/45871] lto bootstrap miscompiles expmed.c
  2010-10-03 14:36 [Bug middle-end/45871] New: lto bootstrap miscompiles expmed.c1 andi-gcc at firstfloor dot org
  2010-10-03 19:42 ` [Bug middle-end/45871] [4.6 Regression] lto bootstrap miscompiles expmed.c rguenth at gcc dot gnu.org
@ 2010-10-03 22:07 ` hubicka at gcc dot gnu.org
  2010-10-04 11:12 ` hubicka at gcc dot gnu.org
  2010-10-14 21:23 ` hubicka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: hubicka at gcc dot gnu.org @ 2010-10-03 22:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |UNCONFIRMED
   Last reconfirmed|2010-10-03 19:42:33         |
   Target Milestone|4.6.0                       |---
            Summary|[4.6 Regression] lto        |lto bootstrap miscompiles
                   |bootstrap miscompiles       |expmed.c
                   |expmed.c                    |
     Ever Confirmed|1                           |0

--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-10-03 22:07:00 UTC ---
The problem is that we have
MEM[ptr+24].predicate access, where ptr is isnsn_code[2000].
The reference really access insn_code[2001].predicate, but since 
get_base_constructor handle ARRAY_REF by calling fold_const_aggregate_ref that
return constructor of insn_code[2000] only, we don't find matching field while
looking for field at offset 24.

I am testing patch that makes get_base_constructor to use
get_ref_base_and_extent and simply adjust the offset of outer reference
accordingly to fix this.

Honza


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

* [Bug middle-end/45871] lto bootstrap miscompiles expmed.c
  2010-10-03 14:36 [Bug middle-end/45871] New: lto bootstrap miscompiles expmed.c1 andi-gcc at firstfloor dot org
  2010-10-03 19:42 ` [Bug middle-end/45871] [4.6 Regression] lto bootstrap miscompiles expmed.c rguenth at gcc dot gnu.org
  2010-10-03 22:07 ` [Bug middle-end/45871] " hubicka at gcc dot gnu.org
@ 2010-10-04 11:12 ` hubicka at gcc dot gnu.org
  2010-10-14 21:23 ` hubicka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: hubicka at gcc dot gnu.org @ 2010-10-04 11:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-10-04 11:12:00 UTC ---
Author: hubicka
Date: Mon Oct  4 11:11:57 2010
New Revision: 164931

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164931
Log:

    PR middle-end/45871
    * tree-ssa-ccp.c (get_base_constructor): Take HOST_WIDE_INT offset;
    use get_ref_base_and_offset to handle references.
    (fold_const_aggregate_ref): Update.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-ccp.c


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

* [Bug middle-end/45871] lto bootstrap miscompiles expmed.c
  2010-10-03 14:36 [Bug middle-end/45871] New: lto bootstrap miscompiles expmed.c1 andi-gcc at firstfloor dot org
                   ` (2 preceding siblings ...)
  2010-10-04 11:12 ` hubicka at gcc dot gnu.org
@ 2010-10-14 21:23 ` hubicka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: hubicka at gcc dot gnu.org @ 2010-10-14 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-10-14 21:23:15 UTC ---
Fixed.


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

end of thread, other threads:[~2010-10-14 21:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-03 14:36 [Bug middle-end/45871] New: lto bootstrap miscompiles expmed.c1 andi-gcc at firstfloor dot org
2010-10-03 19:42 ` [Bug middle-end/45871] [4.6 Regression] lto bootstrap miscompiles expmed.c rguenth at gcc dot gnu.org
2010-10-03 22:07 ` [Bug middle-end/45871] " hubicka at gcc dot gnu.org
2010-10-04 11:12 ` hubicka at gcc dot gnu.org
2010-10-14 21:23 ` hubicka 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).