public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42344]  New: ICE in rs6000.md with ipa-sra for 252.eon
@ 2009-12-09 17:50 janis at gcc dot gnu dot org
  2009-12-10  8:59 ` [Bug middle-end/42344] [4.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-12-09 17:50 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]

GCC trunk gets a ICE when building SPEC CPU2000 test 252.eon with "-O2 -fPIC
-fno-inline", but not with -fno-ipa-sra, on powerpc-linux with secureplt
enabled, as demonstrated by this minimized testcase:

class mrSurfaceList
{
public:
  int *operator[] (int i) const { }
};
int *
makeGrid (mrSurfaceList * l)
{
  return (*l)[0];
}

elm3b149% /home/janis/tools/gcc-trunk-anonsvn/bin/g++ -c -O2 -fPIC -fno-inline
bug.cc
bug.cc: In function ‘int* makeGrid(mrSurfaceList*)’:
bug.cc:10:1: internal compiler error: in output_507, at
config/rs6000/rs6000.md:12527
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The ICE begins with this patch, which adds IPA SRA:

    http://gcc.gnu.org/viewcvs?view=rev&rev=151800

    r151800 | jamborm | 2009-09-17 11:35:38 +0000 (Thu, 17 Sep 2009)


-- 
           Summary: ICE in rs6000.md with ipa-sra for 252.eon
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janis at gcc dot gnu dot org
GCC target triplet: powerpc-linux


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
@ 2009-12-10  8:59 ` pinskia at gcc dot gnu dot org
  2009-12-10 17:26 ` janis at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-10  8:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-12-10 08:59 -------
Off hand, I cannot tell if this is a target issue where the target should have
rejected the sibcall because of secureplt or the IPA-SRA not copying all the
decl flags correctly.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
          Component|tree-optimization           |middle-end
            Summary|ICE in rs6000.md with ipa-  |[4.5 Regression] ICE in
                   |sra for 252.eon             |rs6000.md with ipa-sra for
                   |                            |252.eon
   Target Milestone|---                         |4.5.0


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
  2009-12-10  8:59 ` [Bug middle-end/42344] [4.5 Regression] " pinskia at gcc dot gnu dot org
@ 2009-12-10 17:26 ` janis at gcc dot gnu dot org
  2009-12-11 23:11 ` rguenth at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-12-10 17:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janis at gcc dot gnu dot org  2009-12-10 17:25 -------
The ICE happens with either -m32 or -m64, but after this same patch eon
segfaults in a destructor when compiled with "-m32 -O2 -fPIC" when built with
GCC with secureplt enabled.  valgrind reports some other invalid accesses
before that segfault.  valgrind also complains about mismatched
free()/delete/delete[] in eon, which can be fixed by patching ggString.h with

@@ -89,7 +89,7 @@ private:
         ~StringRep();
         void *operator new(size_t, unsigned long len);
         void *operator new(size_t s) { return new char[s]; }
-//        void operator delete(void *p) { delete p; }
+        void operator delete(void *p) { delete [] (char *)p; }
         int len;
         int refs;
         char str[1];

Peter, can you get someone to look at this further?  I've got a setup to build
and run eon outside of the SPEC framework.


-- 


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
  2009-12-10  8:59 ` [Bug middle-end/42344] [4.5 Regression] " pinskia at gcc dot gnu dot org
  2009-12-10 17:26 ` janis at gcc dot gnu dot org
@ 2009-12-11 23:11 ` rguenth at gcc dot gnu dot org
  2010-01-27 21:17 ` bergner at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-11 23:11 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-12-11 23:11 ` rguenth at gcc dot gnu dot org
@ 2010-01-27 21:17 ` bergner at gcc dot gnu dot org
  2010-01-28  0:18 ` amodra at gmail dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bergner at gcc dot gnu dot org @ 2010-01-27 21:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bergner at gcc dot gnu dot org  2010-01-27 21:17 -------
Confirmed.  Alan, can you have a look at this?  This is ICE'ing at the
gcc_assert(!TARGET_SECURE_PLT) you added to define_insn
"*sibcall_value_nonlocal_sysv<mode>" as part of your fix for PR36634.  The insn
we're ICE'ing on looks like:

(call_insn/u/j:TI 6 18 7 bug.cc:9 (parallel [
            (set (reg:SI 3 3)
                (call (mem:SI (symbol_ref/i:SI ("_ZNK13mrSurfaceListixEi")
[flags 0x1] <function_decl 0x40000371900 operator[]>) [0 S4 A8])
                    (const_int 0 [0x0])))
            (use (const_int 0 [0x0]))
            (use (reg:SI 65 lr))
            (return)
        ]) 493 {*sibcall_value_nonlocal_sysvsi} (expr_list:REG_EH_REGION
(const_int 0 [0x0])
        (nil))
    (nil))


-- 

bergner at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amodra at gmail dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-27 21:17:04
               date|                            |


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-01-27 21:17 ` bergner at gcc dot gnu dot org
@ 2010-01-28  0:18 ` amodra at gmail dot com
  2010-01-28  2:49 ` amodra at gmail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: amodra at gmail dot com @ 2010-01-28  0:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from amodra at gmail dot com  2010-01-28 00:17 -------
I haven't looked in detail at this yet, but why are we getting nonlocal
sibcalls at all for sysv?  rs6000_function_ok_for_sibcall says we shouldn't. 
I'm not sure why the nonlocal sibcall patterns even accept DEFAULT_ABI ==
ABI_V4.

Incidentally, the reason why we can't do a nonlocal sibcall when using secure
plt is that pic_offset_table_rtx (got pointer reg, r30) needs to be live as a
pic plt call stub uses r30.  Since that register is non-volatile it can't be
live for the tail call.


-- 


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-01-28  0:18 ` amodra at gmail dot com
@ 2010-01-28  2:49 ` amodra at gmail dot com
  2010-01-28  8:28 ` amodra at gmail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: amodra at gmail dot com @ 2010-01-28  2:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from amodra at gmail dot com  2010-01-28 02:49 -------
OK, so at the time we call make_decl_rtl for mrSurfaceList::operator[]

(gdb) bt
#0  rs6000_elf_encode_section_info (decl=0x40402a00, rtl=0x404014a0, first=1)
    at /home/alan/src/gcc/gcc/config/rs6000/rs6000.c:23487
#1  0x1082a4e4 in make_decl_rtl (decl=0x40402a00)
    at /home/alan/src/gcc/gcc/varasm.c:1471
#2  0x1082b924 in notice_global_symbol (decl=0x40402a00)
    at /home/alan/src/gcc/gcc/varasm.c:1628
#3  0x108839e8 in cgraph_mark_reachable_node (node=0x4035c1b0)
    at /home/alan/src/gcc/gcc/cgraph.c:1479
#4  0x10889fd0 in cgraph_analyze_functions ()
    at /home/alan/src/gcc/gcc/cgraphunit.c:980
#5  0x1088c250 in cgraph_finalize_compilation_unit ()
    at /home/alan/src/gcc/gcc/cgraphunit.c:1073
#6  0x1012fbdc in cp_write_global_declarations ()
    at /home/alan/src/gcc/gcc/cp/decl2.c:3780

we see these flags on the function decl:
addressable used public static weak autoinline decl_5

The weak flag makes default_binds_local_p decide that this is non-local so
doesn't set SYMBOL_REF_LOCAL_P on the rtl.

Later, here:
(gdb) bt
#0  cgraph_make_node_local (node=0x4035c1b0)
    at /home/alan/src/gcc/gcc/cgraph.c:2157
#1  0x106e15e4 in modify_function () at /home/alan/src/gcc/gcc/tree-sra.c:3798
#2  ipa_early_sra () at /home/alan/src/gcc/gcc/tree-sra.c:3891
#3  0x1051f750 in execute_one_pass (pass=0x11045634)
    at /home/alan/src/gcc/gcc/passes.c:1522
#4  0x1051fac4 in execute_pass_list (pass=0x11045634)
    at /home/alan/src/gcc/gcc/passes.c:1577
#5  0x1051fadc in execute_pass_list (pass=0x11045470)
    at /home/alan/src/gcc/gcc/passes.c:1578
#6  0x105221d4 in do_per_function_toporder (pass=0x11045408)
    at /home/alan/src/gcc/gcc/passes.c:1120
#7  execute_ipa_pass_list (pass=0x11045408)
    at /home/alan/src/gcc/gcc/passes.c:1759
#8  0x1088c034 in ipa_passes () at /home/alan/src/gcc/gcc/cgraphunit.c:1716
#9  cgraph_optimize () at /home/alan/src/gcc/gcc/cgraphunit.c:1775
#10 0x1088c25c in cgraph_finalize_compilation_unit ()
    at /home/alan/src/gcc/gcc/cgraphunit.c:1082
#11 0x1012fbdc in cp_write_global_declarations ()
    at /home/alan/src/gcc/gcc/cp/decl2.c:3780

a bunch of flags on the function decl are cleared, including the weak flag.
So rs6000_function_ok_for_sibcall quite happily says that a sibcall is OK,
***but the rtl flags have not been updated***.
In particular, SYMBOL_REF_LOCAL_P clear stops rs6000.md:sibcall_value_local32
from matching, and we try to use sibcall_value_nonlocal_sysv.

Seems to me that the rtl flags need updating in cgraph_make_node_local.


-- 


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-01-28  2:49 ` amodra at gmail dot com
@ 2010-01-28  8:28 ` amodra at gmail dot com
  2010-02-10 22:49 ` janis at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: amodra at gmail dot com @ 2010-01-28  8:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from amodra at gmail dot com  2010-01-28 08:28 -------
bootstrap and regression testing a fix


-- 

amodra at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |amodra at gmail dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-01-27 21:17:04         |2010-01-28 08:28:09
               date|                            |


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-01-28  8:28 ` amodra at gmail dot com
@ 2010-02-10 22:49 ` janis at gcc dot gnu dot org
  2010-02-10 23:20 ` amodra at gmail dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: janis at gcc dot gnu dot org @ 2010-02-10 22:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from janis at gcc dot gnu dot org  2010-02-10 22:48 -------
Alan, do you have an update on this?  Does you patch fix just the ICE or also
the runtime segfault described in comment #2?


-- 


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-02-10 22:49 ` janis at gcc dot gnu dot org
@ 2010-02-10 23:20 ` amodra at gmail dot com
  2010-02-11  0:50 ` janis at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: amodra at gmail dot com @ 2010-02-10 23:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from amodra at gmail dot com  2010-02-10 23:20 -------
I haven't tested my patch against eon, just the testcase here and of course the
gcc testsuite.  Latest patch url given above


-- 


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2010-02-10 23:20 ` amodra at gmail dot com
@ 2010-02-11  0:50 ` janis at gcc dot gnu dot org
  2010-02-19 23:38 ` amodra at gcc dot gnu dot org
  2010-02-19 23:39 ` amodra at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: janis at gcc dot gnu dot org @ 2010-02-11  0:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from janis at gcc dot gnu dot org  2010-02-11 00:50 -------
I tried the patch and it fixes both of the problems with eon.


-- 


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2010-02-11  0:50 ` janis at gcc dot gnu dot org
@ 2010-02-19 23:38 ` amodra at gcc dot gnu dot org
  2010-02-19 23:39 ` amodra at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: amodra at gcc dot gnu dot org @ 2010-02-19 23:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from amodra at gcc dot gnu dot org  2010-02-19 23:38 -------
Subject: Bug 42344

Author: amodra
Date: Fri Feb 19 23:38:20 2010
New Revision: 156914

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156914
Log:
        PR middle-end/42344
        * cgraph.h (cgraph_make_decl_local): Declare.
        * cgraph.c (cgraph_make_decl_local): New function.
        (cgraph_make_node_local): Use it.
        * cgraphunit.c (cgraph_function_versioning): Likewise.
        * ipa.c (function_and_variable_visibility): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraph.c
    trunk/gcc/cgraph.h
    trunk/gcc/cgraphunit.c
    trunk/gcc/ipa.c


-- 


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


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

* [Bug middle-end/42344] [4.5 Regression] ICE in rs6000.md with ipa-sra for 252.eon
  2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2010-02-19 23:38 ` amodra at gcc dot gnu dot org
@ 2010-02-19 23:39 ` amodra at gmail dot com
  11 siblings, 0 replies; 13+ messages in thread
From: amodra at gmail dot com @ 2010-02-19 23:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from amodra at gmail dot com  2010-02-19 23:39 -------
Fixed


-- 

amodra at gmail dot com changed:

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


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


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

end of thread, other threads:[~2010-02-19 23:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-09 17:50 [Bug tree-optimization/42344] New: ICE in rs6000.md with ipa-sra for 252.eon janis at gcc dot gnu dot org
2009-12-10  8:59 ` [Bug middle-end/42344] [4.5 Regression] " pinskia at gcc dot gnu dot org
2009-12-10 17:26 ` janis at gcc dot gnu dot org
2009-12-11 23:11 ` rguenth at gcc dot gnu dot org
2010-01-27 21:17 ` bergner at gcc dot gnu dot org
2010-01-28  0:18 ` amodra at gmail dot com
2010-01-28  2:49 ` amodra at gmail dot com
2010-01-28  8:28 ` amodra at gmail dot com
2010-02-10 22:49 ` janis at gcc dot gnu dot org
2010-02-10 23:20 ` amodra at gmail dot com
2010-02-11  0:50 ` janis at gcc dot gnu dot org
2010-02-19 23:38 ` amodra at gcc dot gnu dot org
2010-02-19 23:39 ` amodra at gmail dot com

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).