public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17573] New: redefinition of builtin generates error when K&R fn def used
@ 2004-09-20 22:00 bowdidge at apple dot com
2004-09-20 22:39 ` [Bug c/17573] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: bowdidge at apple dot com @ 2004-09-20 22:00 UTC (permalink / raw)
To: gcc-bugs
The following code generates an error if a function is defined in K&R style, but not if the function is
defined in ANSI C style:
extern float dremf ( float, float );
float
dremf(x, y)
float x;
float y;
{
return 1.0;
}
On Apple's gcc-3.5-based compilers, the code generates an error or warning with the K&R C definition,
but generates no error with the ANSI C function declaration. The problem is reproducible on at least
the 9/2 mainline, also with powerpc-apple-darwin.
--
Summary: redefinition of builtin generates error when K&R fn def
used
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bowdidge at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin
GCC host triplet: powerpc-apple-darwin
GCC target triplet: powerpc-apple-darwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17573
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/17573] redefinition of builtin generates error when K&R fn def used
2004-09-20 22:00 [Bug c/17573] New: redefinition of builtin generates error when K&R fn def used bowdidge at apple dot com
@ 2004-09-20 22:39 ` pinskia at gcc dot gnu dot org
2004-09-20 22:44 ` schwab at suse dot de
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-20 22:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-20 22:39 -------
: Search converges between 2004-02-01-trunk (#445) and 2004-03-01-trunk (#446).
I think the code is invalid but I don't know the C standard that well.
Zack I think one of your patches which went in during that time changed the behavior of the C front-
end, what do you think of this bug.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |zack at gcc dot gnu dot org
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17573
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/17573] redefinition of builtin generates error when K&R fn def used
2004-09-20 22:00 [Bug c/17573] New: redefinition of builtin generates error when K&R fn def used bowdidge at apple dot com
2004-09-20 22:39 ` [Bug c/17573] " pinskia at gcc dot gnu dot org
@ 2004-09-20 22:44 ` schwab at suse dot de
2004-09-20 23:11 ` jsm at polyomino dot org dot uk
2004-09-20 23:38 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: schwab at suse dot de @ 2004-09-20 22:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schwab at suse dot de 2004-09-20 22:44 -------
The definition is not compatible with the declaration. In K&R style a
function parameter that is defined as float is actually a double due to
default promotion.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17573
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/17573] redefinition of builtin generates error when K&R fn def used
2004-09-20 22:00 [Bug c/17573] New: redefinition of builtin generates error when K&R fn def used bowdidge at apple dot com
2004-09-20 22:39 ` [Bug c/17573] " pinskia at gcc dot gnu dot org
2004-09-20 22:44 ` schwab at suse dot de
@ 2004-09-20 23:11 ` jsm at polyomino dot org dot uk
2004-09-20 23:38 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-09-20 23:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm at polyomino dot org dot uk 2004-09-20 23:11 -------
Subject: Re: New: redefinition of builtin generates error when
K&R fn def used
On Mon, 20 Sep 2004, bowdidge at apple dot com wrote:
> The following code generates an error if a function is defined in K&R
> style, but not if the function is defined in ANSI C style:
>
> extern float dremf ( float, float );
>
> float
> dremf(x, y)
> float x;
> float y;
> {
> return 1.0;
> }
This seems the same as bug 16666. The code is invalid (prototypes for a
function with an old-style definition must contain the argument types
after default promotions), but is a documented GNU extension.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17573
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/17573] redefinition of builtin generates error when K&R fn def used
2004-09-20 22:00 [Bug c/17573] New: redefinition of builtin generates error when K&R fn def used bowdidge at apple dot com
` (2 preceding siblings ...)
2004-09-20 23:11 ` jsm at polyomino dot org dot uk
@ 2004-09-20 23:38 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-20 23:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-20 23:38 -------
It is a dup of 16666 (an almost evil number:) ).
*** This bug has been marked as a duplicate of 16666 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17573
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-09-20 23:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-20 22:00 [Bug c/17573] New: redefinition of builtin generates error when K&R fn def used bowdidge at apple dot com
2004-09-20 22:39 ` [Bug c/17573] " pinskia at gcc dot gnu dot org
2004-09-20 22:44 ` schwab at suse dot de
2004-09-20 23:11 ` jsm at polyomino dot org dot uk
2004-09-20 23:38 ` 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).