public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25284] New: incorrect double value returned from function testo() called from main().
@ 2005-12-06 19:38 gnassre at earthlink dot net
2005-12-06 19:40 ` [Bug c/25284] " gnassre at earthlink dot net
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gnassre at earthlink dot net @ 2005-12-06 19:38 UTC (permalink / raw)
To: gcc-bugs
inside main(), a call is made to function testo() which simply returns a
double(1415.149). The correct double value is returned only if main.c has
#include <f.h>, which is where testo() is declared.
I've compiled two versions of this program, with and without the include line,
withinclude.a.out and withoutinclude.a.out, respectively. The assembled code
varies slightly between the two, withoutinclude.a.out having the following
extra three lines shown below (with xxx):
realnum=testo();
8048384: e8 2b 00 00 00 call 80483b4 <testo>
8048389: 50 push %eax xxx
804838a: db 04 24 fildl (%esp) xxx
804838d: 8d 64 24 04 lea 0x4(%esp),%esp xxx
8048391: dd 5d f8 fstpl 0xfffffff8(%ebp)
fildl takes the pushed value (0xa) and stores it onto the floating point stack
and then fetched by fstpl, which is then stored in realnum.
This code does NOT get generated if there is an #include <f.h> in main.c
--
Summary: incorrect double value returned from function testo()
called from main().
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gnassre at earthlink dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25284
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/25284] incorrect double value returned from function testo() called from main().
2005-12-06 19:38 [Bug c/25284] New: incorrect double value returned from function testo() called from main() gnassre at earthlink dot net
@ 2005-12-06 19:40 ` gnassre at earthlink dot net
2005-12-06 19:40 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: gnassre at earthlink dot net @ 2005-12-06 19:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from gnassre at earthlink dot net 2005-12-06 19:40 -------
Created an attachment (id=10422)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10422&action=view)
output of gcc -v
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25284
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/25284] incorrect double value returned from function testo() called from main().
2005-12-06 19:38 [Bug c/25284] New: incorrect double value returned from function testo() called from main() gnassre at earthlink dot net
2005-12-06 19:40 ` [Bug c/25284] " gnassre at earthlink dot net
@ 2005-12-06 19:40 ` pinskia at gcc dot gnu dot org
2005-12-06 19:41 ` gnassre at earthlink dot net
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-06 19:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2005-12-06 19:40 -------
The C standard says that if a function is not declared (prototyped) then
implicately it returns the type of int.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25284
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/25284] incorrect double value returned from function testo() called from main().
2005-12-06 19:38 [Bug c/25284] New: incorrect double value returned from function testo() called from main() gnassre at earthlink dot net
2005-12-06 19:40 ` [Bug c/25284] " gnassre at earthlink dot net
2005-12-06 19:40 ` pinskia at gcc dot gnu dot org
@ 2005-12-06 19:41 ` gnassre at earthlink dot net
2005-12-06 19:41 ` gnassre at earthlink dot net
2005-12-06 19:45 ` gnassre at earthlink dot net
4 siblings, 0 replies; 6+ messages in thread
From: gnassre at earthlink dot net @ 2005-12-06 19:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from gnassre at earthlink dot net 2005-12-06 19:41 -------
Created an attachment (id=10424)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10424&action=view)
main() function definition file from gcc --save-temps
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25284
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/25284] incorrect double value returned from function testo() called from main().
2005-12-06 19:38 [Bug c/25284] New: incorrect double value returned from function testo() called from main() gnassre at earthlink dot net
` (2 preceding siblings ...)
2005-12-06 19:41 ` gnassre at earthlink dot net
@ 2005-12-06 19:41 ` gnassre at earthlink dot net
2005-12-06 19:45 ` gnassre at earthlink dot net
4 siblings, 0 replies; 6+ messages in thread
From: gnassre at earthlink dot net @ 2005-12-06 19:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from gnassre at earthlink dot net 2005-12-06 19:41 -------
Created an attachment (id=10423)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10423&action=view)
testo() function definition file from gcc --save-temps
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25284
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/25284] incorrect double value returned from function testo() called from main().
2005-12-06 19:38 [Bug c/25284] New: incorrect double value returned from function testo() called from main() gnassre at earthlink dot net
` (3 preceding siblings ...)
2005-12-06 19:41 ` gnassre at earthlink dot net
@ 2005-12-06 19:45 ` gnassre at earthlink dot net
4 siblings, 0 replies; 6+ messages in thread
From: gnassre at earthlink dot net @ 2005-12-06 19:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from gnassre at earthlink dot net 2005-12-06 19:45 -------
(In reply to comment #1)
> The C standard says that if a function is not declared (prototyped) then
> implicately it returns the type of int.
>
ok thanks, that makes sense =)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25284
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-12-06 19:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-06 19:38 [Bug c/25284] New: incorrect double value returned from function testo() called from main() gnassre at earthlink dot net
2005-12-06 19:40 ` [Bug c/25284] " gnassre at earthlink dot net
2005-12-06 19:40 ` pinskia at gcc dot gnu dot org
2005-12-06 19:41 ` gnassre at earthlink dot net
2005-12-06 19:41 ` gnassre at earthlink dot net
2005-12-06 19:45 ` gnassre at earthlink dot net
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).