public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/36343]  New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
@ 2008-05-27 12:42 rguenth at gcc dot gnu dot org
  2008-05-27 12:46 ` [Bug tree-optimization/36343] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-05-27 12:42 UTC (permalink / raw)
  To: gcc-bugs

extern void abort (void);

void __attribute__((noinline))
bar (int **p)
{
  float *q = (float *)p;
  *q = 0.0;
}

float __attribute__((noinline))
foo (int b)
{
  int *i = 0;
  float f = 1.0;
  int **p;
  if (b)
    p = &i;
  else
    p = (int **)&f;
  bar (p);
  if (b)
    return **p;
  return f;
}

int main()
{
  if (foo(0) != 0.0)
    abort ();
  return 0;
}


We TBAA-prune the points-to-set of p due to the dereference *p but use
the pruned points-to-set for computing the call-clobber variables which
causes f not to be call-clobbered.  Thus we return 1.0 from foo.  Oops.


-- 
           Summary: Wrong code due to bad TBAA pruning of points-to-sets and
                    use in call clobbering
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Keywords: wrong-code, alias
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug tree-optimization/36343] [4.3/4.4 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
@ 2008-05-27 12:46 ` rguenth at gcc dot gnu dot org
  2008-05-27 12:46 ` rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-05-27 12:46 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-05-27 12:45:45
               date|                            |


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


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

* [Bug tree-optimization/36343] [4.3/4.4 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
  2008-05-27 12:46 ` [Bug tree-optimization/36343] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
@ 2008-05-27 12:46 ` rguenth at gcc dot gnu dot org
  2008-05-28 22:12 ` rguenth at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-05-27 12:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-05-27 12:45 -------
If you investigate why this doesn't happen more often you find that
directly_dereferenced is only ever set if you dereference a pointer and the
result is also a pointer.  (Thus the complicated testcase)

In essence - we almost _never_ TBAA-prune the points-to-sets.

The correct solution is (apart from improving the TBAA-pruning) to use the
original points-to solution for computing the call-clobbered variables, not
the TBAA-pruned points-to set.

For 4.3 the easiest and least invasive solution is to rip out the
TBAA-pruning code completely.  This is also the temporary solution for the
mainline.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.3.0 4.4.0
      Known to work|                            |4.1.3 4.2.4
            Summary|Wrong code due to bad TBAA  |[4.3/4.4 Regression] Wrong
                   |pruning of points-to-sets   |code due to bad TBAA pruning
                   |and use in call clobbering  |of points-to-sets and use in
                   |                            |call clobbering
   Target Milestone|---                         |4.3.1


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


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

* [Bug tree-optimization/36343] [4.3/4.4 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
  2008-05-27 12:46 ` [Bug tree-optimization/36343] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
  2008-05-27 12:46 ` rguenth at gcc dot gnu dot org
@ 2008-05-28 22:12 ` rguenth at gcc dot gnu dot org
  2008-05-29 10:33 ` rguenth 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 @ 2008-05-28 22:12 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug tree-optimization/36343] [4.3/4.4 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-05-28 22:12 ` rguenth at gcc dot gnu dot org
@ 2008-05-29 10:33 ` rguenth at gcc dot gnu dot org
  2008-05-29 10:35 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-05-29 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-05-29 10:32 -------
Subject: Bug 36343

Author: rguenth
Date: Thu May 29 10:31:58 2008
New Revision: 136152

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

        PR tree-optimization/36343
        PR tree-optimization/36346
        PR tree-optimization/36347
        * tree-flow.h (clobber_what_p_points_to): Declare.
        * tree-ssa-structalias.c (set_uids_in_ptset): Whether the
        pointed-to variable is dereferenced is irrelevant to whether
        the pointer can access the pointed-to variable.
        (clobber_what_p_points_to): New function.
        * tree-ssa-alias.c (set_initial_properties): Use it.
        * tree-ssa.c (verify_flow_sensitive_alias_info): Adjust
        call clobber check for NMTs.

        * gcc.c-torture/execute/pr36343.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr36343.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-flow.h
    trunk/gcc/tree-ssa-alias.c
    trunk/gcc/tree-ssa-structalias.c
    trunk/gcc/tree-ssa.c


-- 


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


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

* [Bug tree-optimization/36343] [4.3/4.4 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-05-29 10:33 ` rguenth at gcc dot gnu dot org
@ 2008-05-29 10:35 ` rguenth at gcc dot gnu dot org
  2008-06-06 15:04 ` [Bug tree-optimization/36343] [4.3 " rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-05-29 10:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-05-29 10:34 -------
Fixed on the mainline.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.3.0 4.4.0                 |4.3.0
      Known to work|4.1.3 4.2.4                 |4.1.3 4.2.4 4.4.0


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


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

* [Bug tree-optimization/36343] [4.3 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-05-29 10:35 ` rguenth at gcc dot gnu dot org
@ 2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
  2008-08-27 22:09 ` jsm28 at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-06-06 15:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2008-06-06 14:59 -------
4.3.1 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.1                       |4.3.2


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


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

* [Bug tree-optimization/36343] [4.3 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-06-06 15:04 ` [Bug tree-optimization/36343] [4.3 " rguenth at gcc dot gnu dot org
@ 2008-08-27 22:09 ` jsm28 at gcc dot gnu dot org
  2008-09-17 14:47 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-08-27 22:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2008-08-27 22:04 -------
4.3.2 is released, changing milestones to 4.3.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.2                       |4.3.3


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


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

* [Bug tree-optimization/36343] [4.3 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-08-27 22:09 ` jsm28 at gcc dot gnu dot org
@ 2008-09-17 14:47 ` rguenth at gcc dot gnu dot org
  2008-09-17 15:08 ` ebotcazou at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-09-17 14:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-09-17 14:46 -------
Created an attachment (id=16344)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16344&action=view)
patch disabling TBAA pruning

This is the patch we use for openSUSE to fix this bug.


-- 


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


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

* [Bug tree-optimization/36343] [4.3 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-09-17 14:47 ` rguenth at gcc dot gnu dot org
@ 2008-09-17 15:08 ` ebotcazou at gcc dot gnu dot org
  2008-09-17 15:12 ` rguenther at suse dot de
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-09-17 15:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ebotcazou at gcc dot gnu dot org  2008-09-17 15:07 -------
> This is the patch we use for openSUSE to fix this bug.

Any particular reason for not installing it at the FSF as well?


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/36343] [4.3 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-09-17 15:08 ` ebotcazou at gcc dot gnu dot org
@ 2008-09-17 15:12 ` rguenther at suse dot de
  2008-09-19 15:06 ` rguenth at gcc dot gnu dot org
  2008-09-19 15:07 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenther at suse dot de @ 2008-09-17 15:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenther at suse dot de  2008-09-17 15:10 -------
Subject: Re:  [4.3 Regression] Wrong code due
 to bad TBAA pruning of points-to-sets and use in call clobbering

On Wed, 17 Sep 2008, ebotcazou at gcc dot gnu dot org wrote:

> ------- Comment #7 from ebotcazou at gcc dot gnu dot org  2008-09-17 15:07 -------
> > This is the patch we use for openSUSE to fix this bug.
> 
> Any particular reason for not installing it at the FSF as well?

It disables optimizations and the testcase was artificially created by
me from looking at the source.  But let me just submit the patch
(again) and ask for feedback.

Richard.


-- 


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


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

* [Bug tree-optimization/36343] [4.3 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2008-09-17 15:12 ` rguenther at suse dot de
@ 2008-09-19 15:06 ` rguenth at gcc dot gnu dot org
  2008-09-19 15:07 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-09-19 15:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from rguenth at gcc dot gnu dot org  2008-09-19 15:05 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|4.3.0                       |4.3.0 4.3.2
         Resolution|                            |FIXED


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


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

* [Bug tree-optimization/36343] [4.3 Regression] Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering
  2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2008-09-19 15:06 ` rguenth at gcc dot gnu dot org
@ 2008-09-19 15:07 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-09-19 15:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2008-09-19 15:06 -------
Subject: Bug 36343

Author: rguenth
Date: Fri Sep 19 15:04:36 2008
New Revision: 140492

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140492
Log:
2008-09-19  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/36343
        * tree-ssa-structalias.c (struct variable_info): Remove
        directly_dereferenced member.
        (new_var_info): Do not set it.
        (process_constraint_1): Likewise.
        (set_uids_in_ptset): Remove TBAA-pruning code.
        (find_what_p_points_to): Do not pass TBAA-pruning related
        parameters.

        * gcc.c-torture/execute/pr36343.c: New testcase.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/pr36343.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_3-branch/gcc/tree-ssa-structalias.c


-- 


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


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

end of thread, other threads:[~2008-09-19 15:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-27 12:42 [Bug tree-optimization/36343] New: Wrong code due to bad TBAA pruning of points-to-sets and use in call clobbering rguenth at gcc dot gnu dot org
2008-05-27 12:46 ` [Bug tree-optimization/36343] [4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
2008-05-27 12:46 ` rguenth at gcc dot gnu dot org
2008-05-28 22:12 ` rguenth at gcc dot gnu dot org
2008-05-29 10:33 ` rguenth at gcc dot gnu dot org
2008-05-29 10:35 ` rguenth at gcc dot gnu dot org
2008-06-06 15:04 ` [Bug tree-optimization/36343] [4.3 " rguenth at gcc dot gnu dot org
2008-08-27 22:09 ` jsm28 at gcc dot gnu dot org
2008-09-17 14:47 ` rguenth at gcc dot gnu dot org
2008-09-17 15:08 ` ebotcazou at gcc dot gnu dot org
2008-09-17 15:12 ` rguenther at suse dot de
2008-09-19 15:06 ` rguenth at gcc dot gnu dot org
2008-09-19 15:07 ` rguenth at gcc dot gnu dot 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).