public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13228] New: Aliasing problem with IMI with structs
@ 2003-11-29  4:17 pinskia at gcc dot gnu dot org
  2003-11-29  4:19 ` [Bug c/13228] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-29  4:17 UTC (permalink / raw)
  To: gcc-bugs

Even though this sample testcase does not show the problem in the asm (at least on powerpc-
apple-darwin), when debuging a much larger problem (like --enable-intermodule or vpr in SPEC) I 
noticed an aliasing problem.
You can see that there is an aliasing problem by breaking on get_alias_set and having gdb display 
debug_tree(t) and watch to see if you have a type and one called "h" and see that you get one and 
then another (but in reallity they are the same type) and also the aliasing sets are set two different 
values (for this case 3 and 6).  What should happen is that the aliasing set should be the same.
test.i:
struct h
{
  int i;
};
void g(struct h *j1)
{
  j1->i = 1;
}
test1.i:
struct h
{
  int i;
};
void g(struct h*);
int f(struct h *j)
{
  g(j);
  return j->i;
}

-- 
           Summary: Aliasing problem with IMI with structs
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/13228] Aliasing problem with IMI with structs
  2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
@ 2003-11-29  4:19 ` pinskia at gcc dot gnu dot org
  2003-11-29 23:35 ` geoffk at geoffk dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-29  4:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-29 04:19 -------
I am going to look into more but I might need help.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |geoffk at gcc dot gnu dot
                   |                            |org
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-29 04:19:37
               date|                            |
   Target Milestone|---                         |3.4


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


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

* [Bug c/13228] Aliasing problem with IMI with structs
  2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
  2003-11-29  4:19 ` [Bug c/13228] " pinskia at gcc dot gnu dot org
@ 2003-11-29 23:35 ` geoffk at geoffk dot org
  2003-12-16 18:56 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: geoffk at geoffk dot org @ 2003-11-29 23:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From geoffk at geoffk dot org  2003-11-29 23:35 -------
Subject: Re:  Aliasing problem with IMI with structs


This is probably a missing part of the IMI implementation.  When
compiling a single source file, each structure definition defines a
different type that's not compatible with any other structure
definition in that file.  However, when two structures are defined in
two different source files, they can be compatible with each other.

As a bonus, the rules for when this can happen differ between C99 and
C89.  They're implemented in tagged_types_tu_compatible_p in
c-typeck.c.

I couldn't reproduce the reported bug, but it's probably a
manifestation of a non-IMI problem.  Consider the following:

static void g (void * x_p)
{
  struct h { int i; } * x = (struct h *) x_p;
  x->i = 2;
}

int f (void * x_p, void *x2)
{
  struct h { int i; } * x = (struct h *) x_p;
  g (x2);
  return x->i;
}

You can make this into a real program by putting, in another file,

extern int f (void *);
int main(void)
{
  struct h { int i; } xx;
  f (&xx, &xx);
}

and the whole program doesn't violate any aliasing rules.



-- 


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


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

* [Bug c/13228] Aliasing problem with IMI with structs
  2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
  2003-11-29  4:19 ` [Bug c/13228] " pinskia at gcc dot gnu dot org
  2003-11-29 23:35 ` geoffk at geoffk dot org
@ 2003-12-16 18:56 ` pinskia at gcc dot gnu dot org
  2004-04-05  0:55 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-16 18:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-16 18:55 -------
Waiting on the reorg of c-decl.c from Zack.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
   Target Milestone|3.4                         |3.5


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


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

* [Bug c/13228] Aliasing problem with IMI with structs
  2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-12-16 18:56 ` pinskia at gcc dot gnu dot org
@ 2004-04-05  0:55 ` pinskia at gcc dot gnu dot org
  2004-05-13 21:00 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-05  0:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-05 00:55 -------
Should be fixed on the tree-ssa by patches by Dale. Suspending as fixed on the tree-ssa 
but I cannot test as IMA/IMI is broken by Zack's rewrite.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |SUSPENDED
   Target Milestone|3.5.0                       |tree-ssa


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


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

* [Bug c/13228] Aliasing problem with IMI with structs
  2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-04-05  0:55 ` pinskia at gcc dot gnu dot org
@ 2004-05-13 21:00 ` pinskia at gcc dot gnu dot org
  2004-08-02  3:01 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-13 21:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-13 11:47 -------
Fixed for 3.5.0 by the merge of the tree-ssa.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|tree-ssa                    |3.5.0


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


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

* [Bug c/13228] Aliasing problem with IMI with structs
  2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-05-13 21:00 ` pinskia at gcc dot gnu dot org
@ 2004-08-02  3:01 ` pinskia at gcc dot gnu dot org
  2004-08-02 21:47 ` pinskia at gcc dot gnu dot org
  2004-08-03 21:41 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-02  3:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-02 03:01 -------
I was wrong, this is still broken.  The issue is more complex than I had thought.

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


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


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

* [Bug c/13228] Aliasing problem with IMI with structs
  2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-08-02  3:01 ` pinskia at gcc dot gnu dot org
@ 2004-08-02 21:47 ` pinskia at gcc dot gnu dot org
  2004-08-03 21:41 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-02 21:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-02 21:47 -------
Actually the status here it was fixed on the tree-ssa but Dale's patch but broke with Zack's rewrite to c-
decl, me and Dale think we have a fix for this problem now with the mainline and a simple one line 
patch which updates the use of current_file_decl which is no longer used in the C front-end.

-- 


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


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

* [Bug c/13228] Aliasing problem with IMI with structs
  2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-08-02 21:47 ` pinskia at gcc dot gnu dot org
@ 2004-08-03 21:41 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-03 21:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-03 21:41 -------
Fixed by:
2004-08-03 Dale Johannesen <dalej@apple.com>

         * c-common.c: Include opts.h.
        (c_common_get_alias_set): Fix check for a single input file.
        * toplev.c: Remove current_file_decl.
        * tree.h: Ditto.

And I have a small (large in some cases) speedup for c_common_get_alias_set because it does not 
record the aliasing set for the types.

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


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


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

end of thread, other threads:[~2004-08-03 21:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-29  4:17 [Bug c/13228] New: Aliasing problem with IMI with structs pinskia at gcc dot gnu dot org
2003-11-29  4:19 ` [Bug c/13228] " pinskia at gcc dot gnu dot org
2003-11-29 23:35 ` geoffk at geoffk dot org
2003-12-16 18:56 ` pinskia at gcc dot gnu dot org
2004-04-05  0:55 ` pinskia at gcc dot gnu dot org
2004-05-13 21:00 ` pinskia at gcc dot gnu dot org
2004-08-02  3:01 ` pinskia at gcc dot gnu dot org
2004-08-02 21:47 ` pinskia at gcc dot gnu dot org
2004-08-03 21:41 ` pinskia 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).