public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/6024: GCC fails to diagnose mismatch of enum types in  prototype/function
@ 2002-03-21  3:56 Joseph S. Myers
  0 siblings, 0 replies; 5+ messages in thread
From: Joseph S. Myers @ 2002-03-21  3:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/6024; it has been noted by GNATS.

From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <Richard.Earnshaw@arm.com>
Cc: <rearnsha@arm.com>,  <gcc-gnats@gcc.gnu.org>,  <gcc-bugs@gcc.gnu.org>
Subject: Re: c/6024: GCC fails to diagnose mismatch of enum types in 
 prototype/function
Date: Thu, 21 Mar 2002 11:51:07 +0000 (GMT)

 On Thu, 21 Mar 2002, Richard Earnshaw wrote:
 
 > struct s1 {int a, int b};
 > struct s2 {int c, int d};
 
 > s1 and s2 are 'compatible'; but they aren't the same.  Where in the 
 > standard does it say that enum types are 'weak' like this?
 
 s1 and s2 aren't compatible.  Compatibility is defined in 6.2.7#1,
 augmented by 6.7.2.2#4 (which specifies that enumerated types are
 compatible with char or a signed or unsigned integer type) and some other
 clauses.  There are rules about when structure types in different
 translation units are compatible, but nothing that would make s1 and s2
 compatible in any case.  (However, I can't see anything that says that two
 enumerated types compatible with "int" (say) are compatible with each
 other either, so it isn't clear what's intended here.)
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 


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

* Re: c/6024: GCC fails to diagnose mismatch of enum types in prototype/function
@ 2003-03-07  2:35 bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: bangerth @ 2003-03-07  2:35 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rearnsha

Synopsis: GCC fails to diagnose mismatch of enum types in prototype/function

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Mar  7 02:35:35 2003
State-Changed-Why:
    Still applies, as of today.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6024


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

* Re: c/6024: GCC fails to diagnose mismatch of enum types in  prototype/function
@ 2002-03-21  3:36 Richard Earnshaw
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Earnshaw @ 2002-03-21  3:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/6024; it has been noted by GNATS.

From: Richard Earnshaw <rearnsha@arm.com>
To: "Joseph S. Myers" <jsm28@cam.ac.uk>
Cc: rearnsha@arm.com, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Subject: Re: c/6024: GCC fails to diagnose mismatch of enum types in 
 prototype/function
Date: Thu, 21 Mar 2002 11:30:58 +0000

 > The types are compatible, which means these declarations are OK.  (Unless
 > you use -fshort-enums, in which case the type in the prototype disagrees
 > with the promoted type from the non-prototype definition.)
 
 
 I *might* accept that argument if -Wall gave a diagnostic message for 
 this.  However, I don't see why this case is any different from
 
 struct s1 {int a, int b};
 struct s2 {int c, int d};
 
 void f(struct s1 *);
 
 void f(x)
   struct s2 *x;
 {
   return;
 }
 
 s1 and s2 are 'compatible'; but they aren't the same.  Where in the 
 standard does it say that enum types are 'weak' like this?
 


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

* Re: c/6024: GCC fails to diagnose mismatch of enum types in prototype/function
@ 2002-03-21  3:26 Joseph S. Myers
  0 siblings, 0 replies; 5+ messages in thread
From: Joseph S. Myers @ 2002-03-21  3:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/6024; it has been noted by GNATS.

From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <rearnsha@arm.com>
Cc: <gcc-gnats@gcc.gnu.org>,  <gcc-bugs@gcc.gnu.org>
Subject: Re: c/6024: GCC fails to diagnose mismatch of enum types in
 prototype/function
Date: Thu, 21 Mar 2002 11:15:46 +0000 (GMT)

 On 21 Mar 2002 rearnsha@arm.com wrote:
 
 > Gcc fails to diagnose when an enum type in a prototype
 > fails to match the enum type in a function declation.
 > >How-To-Repeat:
 > Compile the following code, GCC compiles it without error: it
 > should generate a diagnostic.
 
 The types are compatible, which means these declarations are OK.  (Unless
 you use -fshort-enums, in which case the type in the prototype disagrees
 with the promoted type from the non-prototype definition.)
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 


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

* c/6024: GCC fails to diagnose mismatch of enum types in prototype/function
@ 2002-03-21  3:06 rearnsha
  0 siblings, 0 replies; 5+ messages in thread
From: rearnsha @ 2002-03-21  3:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6024
>Category:       c
>Synopsis:       GCC fails to diagnose mismatch of enum types in prototype/function
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 21 03:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Richard Earnshaw
>Release:        unknown-1.0
>Organization:
>Environment:
All gcc targets
>Description:
Gcc fails to diagnose when an enum type in a prototype
fails to match the enum type in a function declation.
>How-To-Repeat:
Compile the following code, GCC compiles it without error: it
should generate a diagnostic.

enum e1 {a, b};
enum e2 {c, d};

void f(enum e1);

void f(x)
  enum e2 x;
{
  return;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-03-07  2:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-21  3:56 c/6024: GCC fails to diagnose mismatch of enum types in prototype/function Joseph S. Myers
  -- strict thread matches above, loose matches on Subject: below --
2003-03-07  2:35 bangerth
2002-03-21  3:36 Richard Earnshaw
2002-03-21  3:26 Joseph S. Myers
2002-03-21  3:06 rearnsha

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).