public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Regression in 4.0 (sort of)
@ 2004-12-13  3:53 Dale Johannesen
  2004-12-13  4:07 ` Zack Weinberg
  0 siblings, 1 reply; 3+ messages in thread
From: Dale Johannesen @ 2004-12-13  3:53 UTC (permalink / raw)
  To: gcc mailing list; +Cc: Dale Johannesen

Consider the nonstandard C program

main() {
   foo();
}
void foo() {
}

Previous versions of gcc accepted this with a warning; 4.0 gives an 
error.
This appears to date to Zack's rewrite of duplicate_decls early this 
year.
Naturally, this is causing some programs not to compile any more.
Geoff thinks this may be unintentional, and certainly it doesn't seem 
that
any bugs that would actually cause anything to break would slip through
if we treated it as a warning.  Is this an intentional change?

The following exception is already made for a different, but quite 
similar, case.
       /* Permit void foo (...) to match int foo (...) if the latter is
          the definition and implicit int was used.  See
          c-torture/compile/920625-2.c.  */

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

* Re: Regression in 4.0 (sort of)
  2004-12-13  3:53 Regression in 4.0 (sort of) Dale Johannesen
@ 2004-12-13  4:07 ` Zack Weinberg
  2004-12-13 16:43   ` Dale Johannesen
  0 siblings, 1 reply; 3+ messages in thread
From: Zack Weinberg @ 2004-12-13  4:07 UTC (permalink / raw)
  To: Dale Johannesen; +Cc: gcc mailing list

Dale Johannesen <dalej@apple.com> writes:

> Consider the nonstandard C program
>
> main() {
>    foo();
> }
> void foo() {
> }
>
> Previous versions of gcc accepted this with a warning; 4.0 gives an
> error.  This appears to date to Zack's rewrite of duplicate_decls
> early this year.  Naturally, this is causing some programs not to
> compile any more.  Geoff thinks this may be unintentional, and
> certainly it doesn't seem that any bugs that would actually cause
> anything to break would slip through if we treated it as a warning.
> Is this an intentional change?

No; in fact I'm surprised that this exception

> The following exception is already made for a different, but quite
> similar, case.
>        /* Permit void foo (...) to match int foo (...) if the latter is
>           the definition and implicit int was used.  See
>           c-torture/compile/920625-2.c.  */

doesn't cover this case.  I suppose it's because there's a difference
between "declared implicitly" and "declared using implicit int".  I'd
be in favor of extending this case to cover your example.

zw

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

* Re: Regression in 4.0 (sort of)
  2004-12-13  4:07 ` Zack Weinberg
@ 2004-12-13 16:43   ` Dale Johannesen
  0 siblings, 0 replies; 3+ messages in thread
From: Dale Johannesen @ 2004-12-13 16:43 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: Dale Johannesen, gcc mailing list


On Dec 12, 2004, at 8:07 PM, Zack Weinberg wrote:

> Dale Johannesen <dalej@apple.com> writes:
>
>> Consider the nonstandard C program
>>
>> main() {
>>    foo();
>> }
>> void foo() {
>> }
>>
>
> No; in fact I'm surprised that this exception
>
>> The following exception is already made for a different, but quite
>> similar, case.
>>        /* Permit void foo (...) to match int foo (...) if the latter 
>> is
>>           the definition and implicit int was used.  See
>>           c-torture/compile/920625-2.c.  */
>
> doesn't cover this case.  I suppose it's because there's a difference
> between "declared implicitly" and "declared using implicit int".  I'd
> be in favor of extending this case to cover your example.

No, it's because the code does exactly what the comment says:  the
implicit int must be the definition, and must be the second occurrence:

extern void foo();
foo() {}

I'll put together a patch.

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

end of thread, other threads:[~2004-12-13 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-13  3:53 Regression in 4.0 (sort of) Dale Johannesen
2004-12-13  4:07 ` Zack Weinberg
2004-12-13 16:43   ` Dale Johannesen

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