public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/30708]  New: [4.1 Regression] Aliasing miscompilation
@ 2007-02-05 13:21 jakub at gcc dot gnu dot org
  2007-02-05 14:19 ` [Bug tree-optimization/30708] " rguenth at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-02-05 13:21 UTC (permalink / raw)
  To: gcc-bugs

struct obj_symbol
{
 struct obj_symbol *next;
 unsigned int size;
};

struct common_entry
{
 struct common_entry *next;
 struct obj_symbol *sym;
};

extern void do_something(struct obj_symbol *sym);

void obj_allocate_commons(struct obj_symbol *sym)
{
 struct common_entry *common_head = ((void *)0);

 for (; sym ; sym = sym->next) {
  struct common_entry **p, *n;
  for (p = &common_head; *p ; p = &(*p)->next)
   if (sym->size <= (*p)->sym->size)
    break;

  n = __builtin_alloca (sizeof(*n));
  n->next = *p;
  n->sym = sym;
  *p = n;
 }

 {
  struct common_entry *p;
  for (p = common_head; p ; p = p->next)
   do_something(p->sym);
 }
}

is miscompiled on gcc-4_1-branch at least on x84_64-linux, with -O2 and above
(but not with -fno-strict-aliasing).
The common_head = NULL initialization is removed as dead during 1st DCE pass,
but from quick skimming the reason for that seems to be incorrect aliasing
information.


-- 
           Summary: [4.1 Regression] Aliasing miscompilation
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

* [Bug tree-optimization/30708] [4.1 Regression] Aliasing miscompilation
  2007-02-05 13:21 [Bug tree-optimization/30708] New: [4.1 Regression] Aliasing miscompilation jakub at gcc dot gnu dot org
@ 2007-02-05 14:19 ` rguenth at gcc dot gnu dot org
  2007-02-21 15:17 ` rguenth at gcc dot gnu dot org
  2008-07-04 15:57 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-05 14:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-02-05 14:19 -------
Confirmed.  Maybe related to PR30088.  The first alias dump at -O2 (-O
-fstrict-aliasing is fine) has

<bb 0>:
  #   common_head_5 = V_MUST_DEF <common_head_4>;
  common_head = 0B;

...

<L0>:;
  p_10 = &common_head;
  goto <bb 4> (<L3>);

<L1>:;
  #   VUSE <TMT.6_24>;
  D.1631_16 = sym_1->size;
  #   VUSE <HEAP.5_22>;
  D.1632_17 = *p_2;
...

  # p_2 = PHI <p_10(1), p_21(3)>;
<L3>:;
  #   VUSE <HEAP.5_22>;
  D.1632_11 = *p_2;
  if (D.1632_11 != 0B) goto <L1>; else goto <L4>;


so we have both HEAP.5 and common_head_5 used as tags for common_heap.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |alias, wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-05 14:19:20
               date|                            |


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


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

* [Bug tree-optimization/30708] [4.1 Regression] Aliasing miscompilation
  2007-02-05 13:21 [Bug tree-optimization/30708] New: [4.1 Regression] Aliasing miscompilation jakub at gcc dot gnu dot org
  2007-02-05 14:19 ` [Bug tree-optimization/30708] " rguenth at gcc dot gnu dot org
@ 2007-02-21 15:17 ` rguenth at gcc dot gnu dot org
  2008-07-04 15:57 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-21 15:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.3


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


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

* [Bug tree-optimization/30708] [4.1 Regression] Aliasing miscompilation
  2007-02-05 13:21 [Bug tree-optimization/30708] New: [4.1 Regression] Aliasing miscompilation jakub at gcc dot gnu dot org
  2007-02-05 14:19 ` [Bug tree-optimization/30708] " rguenth at gcc dot gnu dot org
  2007-02-21 15:17 ` rguenth at gcc dot gnu dot org
@ 2008-07-04 15:57 ` jsm28 at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 15:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jsm28 at gcc dot gnu dot org  2008-07-04 15:57 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.1.0 4.1.1 4.1.2           |4.1.0 4.1.1 4.1.2 4.1.3
      Known to work|4.0.3                       |4.0.3 4.2.0
         Resolution|                            |FIXED
   Target Milestone|4.1.3                       |4.2.0


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


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-05 13:21 [Bug tree-optimization/30708] New: [4.1 Regression] Aliasing miscompilation jakub at gcc dot gnu dot org
2007-02-05 14:19 ` [Bug tree-optimization/30708] " rguenth at gcc dot gnu dot org
2007-02-21 15:17 ` rguenth at gcc dot gnu dot org
2008-07-04 15:57 ` jsm28 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).