public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/60912] New: [4.10 Regression] wrong code with -O -fno-inline -fipa-pta
@ 2014-04-21  9:51 zsojka at seznam dot cz
  2014-04-22  8:45 ` [Bug ipa/60912] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2014-04-21  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60912
           Summary: [4.10 Regression] wrong code with -O -fno-inline
                    -fipa-pta
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz

Created attachment 32647
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32647&action=edit
reduced testcase (g++.dg/tree-ssa/20040317-1.C)

Output:
$ g++ -O -fno-inline -fipa-pta testcase.C
$ ./a.out 
Segmentation fault

Relevant disassembly diff 4.9/4.10:
@@ -61,9 +61,8 @@
        mov     QWORD PTR [rax], 0
        mov     rdi, rax
        call    _ZN3BarC1Ev
-       mov     rax, QWORD PTR [rbx]
        mov     rdi, rbx
-       call    [QWORD PTR [rax]]
+       call    [QWORD PTR ds:0]
        mov     eax, 0
        pop     rbx
        .cfi_def_cfa_offset 8

In 4.10, vtable seems to be expected to be constant 0.


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

* [Bug ipa/60912] [4.10 Regression] wrong code with -O -fno-inline -fipa-pta
  2014-04-21  9:51 [Bug ipa/60912] New: [4.10 Regression] wrong code with -O -fno-inline -fipa-pta zsojka at seznam dot cz
@ 2014-04-22  8:45 ` rguenth at gcc dot gnu.org
  2014-04-23 10:15 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-22  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-04-22
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Target Milestone|---                         |4.10.0
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'll have a look.


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

* [Bug ipa/60912] [4.10 Regression] wrong code with -O -fno-inline -fipa-pta
  2014-04-21  9:51 [Bug ipa/60912] New: [4.10 Regression] wrong code with -O -fno-inline -fipa-pta zsojka at seznam dot cz
  2014-04-22  8:45 ` [Bug ipa/60912] " rguenth at gcc dot gnu.org
@ 2014-04-23 10:15 ` rguenth at gcc dot gnu.org
  2014-04-24 10:59 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-23 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Likely related to PR60911, waiting for that to be resolved.


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

* [Bug ipa/60912] [4.10 Regression] wrong code with -O -fno-inline -fipa-pta
  2014-04-21  9:51 [Bug ipa/60912] New: [4.10 Regression] wrong code with -O -fno-inline -fipa-pta zsojka at seznam dot cz
  2014-04-22  8:45 ` [Bug ipa/60912] " rguenth at gcc dot gnu.org
  2014-04-23 10:15 ` rguenth at gcc dot gnu.org
@ 2014-04-24 10:59 ` rguenth at gcc dot gnu.org
  2014-04-25  7:48 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-24 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, the issue here is that Bar::Bar()s ->callers is empty even though it is
called by main.

main/7 (int main()) @0x7ffff6daea40
  Type: function definition analyzed
  Visibility: externally_visible public
  References: 
  Referring: 
  Availability: available
  First run: 0
  Function flags: body only_called_at_startup
  Called by: 
  Calls: _ZN3BarC1Ev/6 (1.00 per call) _Znwm/14 (1.00 per call) (can throw
external) 
  Has 1 outgoing edges for indirect calls.

_ZN3BarC2Ev/5 (Bar::Bar()) @0x7ffff6dae7b0
  Type: function definition analyzed
  Visibility: externally_visible public weak comdat comdat_group:_ZN3BarC5Ev
one_only artificial
  Same comdat group as: _ZN3BarC1Ev/6
  References: _ZTV3Bar/8 (addr)
  Referring: _ZN3BarC1Ev/6 (alias)
  Availability: available
  First run: 0
  Function flags: body
  Called by: 
  Calls: _ZN4IFooC2Ev/2 (1.00 per call) 

Ah, main() calls _ZN3BarC1Ev/6 but we only have a body for _ZN3BarC2Ev/5.

_ZN3BarC1Ev/6 (Bar::Bar()) @0x7ffff6dae8f8
  Type: function definition analyzed alias cpp_implicit_alias
  Visibility: externally_visible public weak comdat comdat_group:_ZN3BarC5Ev
one_only artificial
  Same comdat group as: _ZN3BarC2Ev/5
  References: _ZN3BarC2Ev/5 (alias)
  Referring: 
  Availability: available
  First run: 0
  Function flags:
  Called by: main/7 (1.00 per call) 
  Calls: 

That means that

      for (e = node->callers; e; e = e->next_caller)
        {
          if (!e->call_stmt)
            continue;

...
        }

to walk all call stmts that call node doesn't work.

But next_/previous_sharing_asm_name is empty (of course).

Oh, we do associate_varinfo_to_alias in PTA which of course breaks the
above (at least for functions).

So we really need a way to walk, given a ultimate callee, all edges
that ultimately result in it.  With the caching done for
find_what_var_points_to we can avoid this walking.  Let's do that.

The issue is latent on branches.


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

* [Bug ipa/60912] [4.10 Regression] wrong code with -O -fno-inline -fipa-pta
  2014-04-21  9:51 [Bug ipa/60912] New: [4.10 Regression] wrong code with -O -fno-inline -fipa-pta zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2014-04-24 10:59 ` rguenth at gcc dot gnu.org
@ 2014-04-25  7:48 ` rguenth at gcc dot gnu.org
  2014-04-25  7:49 ` rguenth at gcc dot gnu.org
  2014-04-25  7:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-25  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Apr 25 07:47:22 2014
New Revision: 209780

URL: http://gcc.gnu.org/viewcvs?rev=209780&root=gcc&view=rev
Log:
2014-04-25  Richard Biener  <rguenther@suse.de>

    PR ipa/60912
    * tree-ssa-structalias.c (ipa_pta_execute): Compute direct
    call stmt use/clobber sets during stmt walk instead of
    walking the possibly incomplete set of caller edges.

    * g++.dg/opt/pr60912.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr60912.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-structalias.c


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

* [Bug ipa/60912] [4.10 Regression] wrong code with -O -fno-inline -fipa-pta
  2014-04-21  9:51 [Bug ipa/60912] New: [4.10 Regression] wrong code with -O -fno-inline -fipa-pta zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2014-04-25  7:48 ` rguenth at gcc dot gnu.org
@ 2014-04-25  7:49 ` rguenth at gcc dot gnu.org
  2014-04-25  7:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-25  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Apr 25 07:49:03 2014
New Revision: 209782

URL: http://gcc.gnu.org/viewcvs?rev=209782&root=gcc&view=rev
Log:
2014-04-25  Richard Biener  <rguenther@suse.de>

    PR ipa/60912
    * tree-ssa-structalias.c (ipa_pta_execute): Compute direct
    call stmt use/clobber sets during stmt walk instead of
    walking the possibly incomplete set of caller edges.

    * g++.dg/opt/pr60912.C: New testcase.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/opt/pr60912.C
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-ssa-structalias.c


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

* [Bug ipa/60912] [4.10 Regression] wrong code with -O -fno-inline -fipa-pta
  2014-04-21  9:51 [Bug ipa/60912] New: [4.10 Regression] wrong code with -O -fno-inline -fipa-pta zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2014-04-25  7:49 ` rguenth at gcc dot gnu.org
@ 2014-04-25  7:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-25  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-04-25  7:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21  9:51 [Bug ipa/60912] New: [4.10 Regression] wrong code with -O -fno-inline -fipa-pta zsojka at seznam dot cz
2014-04-22  8:45 ` [Bug ipa/60912] " rguenth at gcc dot gnu.org
2014-04-23 10:15 ` rguenth at gcc dot gnu.org
2014-04-24 10:59 ` rguenth at gcc dot gnu.org
2014-04-25  7:48 ` rguenth at gcc dot gnu.org
2014-04-25  7:49 ` rguenth at gcc dot gnu.org
2014-04-25  7:50 ` 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).