public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14805] New: file with structures and external decls at function scope is wrongly rejected
@ 2004-04-01  2:17 geoffk at gcc dot gnu dot org
  2004-04-01  2:19 ` [Bug c/14805] " geoffk at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2004-04-01  2:17 UTC (permalink / raw)
  To: gcc-bugs

The following code is valid C and was accepted by 3.5:

int foo_A (void) {
  struct baz;
  struct bar {
    struct baz *x;
  };
  extern struct bar *foo;
  return foo->x == 0;
}

int foo_B (void) {
  struct baz {
     int y;
  };
  struct bar {
    struct baz *x;
  };
  extern struct bar *foo;
  return foo->x->y + 1 + foo_A();
}

but is rejected by current HEAD with the following:

/Network/Servers/cauchy/homes/thorin/gkeating/t.c: In function `foo_B':
/Network/Servers/cauchy/homes/thorin/gkeating/t.c:17: error: conflicting types for 'foo'
/Network/Servers/cauchy/homes/thorin/gkeating/t.c:6: error: previous declaration of 'foo' was here

-- 
           Summary: file with structures and external decls at function
                    scope is wrongly rejected
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: geoffk at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.2
  GCC host triplet: powerpc-apple-darwin7.2
GCC target triplet: powerpc-apple-darwin7.2


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


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

* [Bug c/14805] file with structures and external decls at function scope is wrongly rejected
  2004-04-01  2:17 [Bug c/14805] New: file with structures and external decls at function scope is wrongly rejected geoffk at gcc dot gnu dot org
@ 2004-04-01  2:19 ` geoffk at gcc dot gnu dot org
  2004-04-01  2:23 ` [Bug c/14805] [3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2004-04-01  2:19 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |zack at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-01 02:19:35
               date|                            |


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


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

* [Bug c/14805] [3.5 Regression] file with structures and external decls at function scope is wrongly rejected
  2004-04-01  2:17 [Bug c/14805] New: file with structures and external decls at function scope is wrongly rejected geoffk at gcc dot gnu dot org
  2004-04-01  2:19 ` [Bug c/14805] " geoffk at gcc dot gnu dot org
@ 2004-04-01  2:23 ` pinskia at gcc dot gnu dot org
  2004-04-01  2:44 ` zack at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-01  2:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-01 02:23 -------
Is this really valid C, with ICC 6.0 in strict mode, I get an error:
t.c
t.c(17): error: declaration is incompatible with previous "foo" (declared at line 6)
    extern struct bar *foo;
                       ^

compilation aborted for t.c (code 2)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
            Summary|file with structures and    |[3.5 Regression] file with
                   |external decls at function  |structures and external
                   |scope is wrongly rejected   |decls at function scope is
                   |                            |wrongly rejected
   Target Milestone|---                         |3.5.0


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


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

* [Bug c/14805] [3.5 Regression] file with structures and external decls at function scope is wrongly rejected
  2004-04-01  2:17 [Bug c/14805] New: file with structures and external decls at function scope is wrongly rejected geoffk at gcc dot gnu dot org
  2004-04-01  2:19 ` [Bug c/14805] " geoffk at gcc dot gnu dot org
  2004-04-01  2:23 ` [Bug c/14805] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-04-01  2:44 ` zack at gcc dot gnu dot org
  2004-04-01 11:46 ` neil at gcc dot gnu dot org
  2004-04-01 20:01 ` geoffk at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: zack at gcc dot gnu dot org @ 2004-04-01  2:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at gcc dot gnu dot org  2004-04-01 02:44 -------
It is at the very least compile-time undefined behavior per C99 6.2.7p2.

-- 


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


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

* [Bug c/14805] [3.5 Regression] file with structures and external decls at function scope is wrongly rejected
  2004-04-01  2:17 [Bug c/14805] New: file with structures and external decls at function scope is wrongly rejected geoffk at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-04-01  2:44 ` zack at gcc dot gnu dot org
@ 2004-04-01 11:46 ` neil at gcc dot gnu dot org
  2004-04-01 20:01 ` geoffk at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: neil at gcc dot gnu dot org @ 2004-04-01 11:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From neil at gcc dot gnu dot org  2004-04-01 11:46 -------
FWIW I agree - this is not "valid C".  IMO a good implementation will reject it
as having the same object declared twice with incompatible types.

-- 


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


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

* [Bug c/14805] [3.5 Regression] file with structures and external decls at function scope is wrongly rejected
  2004-04-01  2:17 [Bug c/14805] New: file with structures and external decls at function scope is wrongly rejected geoffk at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-04-01 11:46 ` neil at gcc dot gnu dot org
@ 2004-04-01 20:01 ` geoffk at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2004-04-01 20:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From geoffk at gcc dot gnu dot org  2004-04-01 20:01 -------
Zack is right.  I will come up with a better example.

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


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


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

end of thread, other threads:[~2004-04-01 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-01  2:17 [Bug c/14805] New: file with structures and external decls at function scope is wrongly rejected geoffk at gcc dot gnu dot org
2004-04-01  2:19 ` [Bug c/14805] " geoffk at gcc dot gnu dot org
2004-04-01  2:23 ` [Bug c/14805] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-04-01  2:44 ` zack at gcc dot gnu dot org
2004-04-01 11:46 ` neil at gcc dot gnu dot org
2004-04-01 20:01 ` geoffk 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).