Bug 27898 - Compile failure with --combine and anonymous structures
Summary: Compile failure with --combine and anonymous structures
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Alexandre Oliva
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: patch, rejects-valid
Depends on:
Blocks: 28779
  Show dependency treegraph
 
Reported: 2006-06-05 09:55 UTC by David Woodhouse
Modified: 2007-11-26 16:24 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-07-05 06:02:55


Attachments
Patch that fixes the bug (689 bytes, patch)
2006-07-05 06:04 UTC, Alexandre Oliva
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Woodhouse 2006-06-05 09:55:37 UTC
$ cat foobar.c
union u {
        struct {
                int i;
        };
};

extern int somefunc(union u *);
$ gcc --combine -c foobar.c foobar.c
foobar.c:8: error: conflicting types for 'somefunc'
foobar.c:8: error: previous declaration of 'somefunc' was here

gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)

Happens on both PowerPC and i386. If the internal structure is made non-anonymous, it compiles.
Comment 1 Alexandre Oliva 2006-07-05 06:04:21 UTC
Created attachment 11822 [details]
Patch that fixes the bug

This patch fixes the problem for me.
Comment 2 patchapp@dberlin.org 2006-07-06 03:45:12 UTC
Subject: Bug number PR27898

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00187.html
Comment 3 David Woodhouse 2006-08-13 10:30:49 UTC
That simple test case seems to have been fixed with your patch -- thanks.
Next failure reported as PR28706.

Full test cases in Red Hat bug #194327 at https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=194327

Comment 4 Alexandre Oliva 2007-11-26 06:26:34 UTC
Subject: Bug 27898

Author: aoliva
Date: Mon Nov 26 06:26:18 2007
New Revision: 130425

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130425
Log:
PR c/27898
* c-typeck.c (tagged_types_tu_compatible_p): Enable exact
matches between anonymous union fields.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c

Comment 5 Alexandre Oliva 2007-11-26 16:24:29 UTC
Fixed.
Comment 6 uros 2009-03-25 07:59:10 UTC
Subject: Bug 27898

Author: uros
Date: Wed Mar 25 07:58:55 2009
New Revision: 145052

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145052
Log:
	PR c/27898
	* gcc.dg/pr27898.c: New test.

	PR tree-optimization/32139
	* gcc.c-torture/compile/pr32139.c: New test.


Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr32139.c
    trunk/gcc/testsuite/gcc.dg/pr27898.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog