public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56397] New: Floating Point constant in C, with standard C99
@ 2013-02-19 14:37 argentinator.gcc.questions at outlook dot com
2013-02-19 15:13 ` [Bug c/56397] " redi at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: argentinator.gcc.questions at outlook dot com @ 2013-02-19 14:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
Bug #: 56397
Summary: Floating Point constant in C, with standard C99
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: argentinator.gcc.questions@outlook.com
Created attachment 29496
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29496
Source code, ".i" file, and compiler output in a ".txt" file.
I think that the compiler doesn't recognize properly the type of the
floating-point constants for the standard C99.
A straight example is the simple sentence:
(1.1F & 1);
In this case, 1.1F should be considered as a 'float' constant,
but the compiler triggers this error message:
error: invalid operands to binary & (have 'long double' and 'int')
Thus, the compiler considers that 1.1F has type 'long double', but 'float' is
expected.
I am running GCC 4.6.1 with MinGW, under a Windows 7 system.
In my system, FLT_EVAL_METHOD == 2, but I think that this is not the problem,
and that we have actually some kind of compiler bug.
The source code is just this:
---------------------------------------------------
int main(void) {
1.1F & 1;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/56397] Floating Point constant in C, with standard C99
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
@ 2013-02-19 15:13 ` redi at gcc dot gnu.org
2013-02-19 16:57 ` argentinator.gcc.questions at outlook dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-19 15:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-19 15:12:56 UTC ---
I get the expected result with 4.7.2 on MinGW and with all versions on
GNU/Linux
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/56397] Floating Point constant in C, with standard C99
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
2013-02-19 15:13 ` [Bug c/56397] " redi at gcc dot gnu.org
@ 2013-02-19 16:57 ` argentinator.gcc.questions at outlook dot com
2013-02-19 17:10 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: argentinator.gcc.questions at outlook dot com @ 2013-02-19 16:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
--- Comment #2 from argentinator.gcc.questions at outlook dot com 2013-02-19 16:56:52 UTC ---
(In reply to comment #1)
> I get the expected result with 4.7.2 on MinGW and with all versions on
> GNU/Linux
I have reinstalled MinGW in my computer, under Windows 7.
Now I have GCC 4.7.2, and I still get the non-expected result, that is, I
obtain again the same error message that considers 1.1F as a 'long double'
constant.
(The compiler option is always -std=c99).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/56397] Floating Point constant in C, with standard C99
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
2013-02-19 15:13 ` [Bug c/56397] " redi at gcc dot gnu.org
2013-02-19 16:57 ` argentinator.gcc.questions at outlook dot com
@ 2013-02-19 17:10 ` redi at gcc dot gnu.org
2013-02-19 17:11 ` joseph at codesourcery dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-19 17:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |*-*-mingw32
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-19 17:10:10 UTC ---
(In reply to comment #2)
> (The compiler option is always -std=c99).
Ah sorry, although I used -std=c99 on GNU/Linux, I didn't on MinGW, and can
confirm it says 'long double' with 4.7.2 on MinGW, so it looks like a target
issue.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/56397] Floating Point constant in C, with standard C99
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
` (2 preceding siblings ...)
2013-02-19 17:10 ` redi at gcc dot gnu.org
@ 2013-02-19 17:11 ` joseph at codesourcery dot com
2013-02-19 18:58 ` argentinator.gcc.questions at outlook dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: joseph at codesourcery dot com @ 2013-02-19 17:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2013-02-19 17:10:46 UTC ---
This looks like it's just an issue with the diagnostic text
(binary_op_error being called with the type in which the floating-point
operand is being represented, rather than with its semantic type).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/56397] Floating Point constant in C, with standard C99
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
` (3 preceding siblings ...)
2013-02-19 17:11 ` joseph at codesourcery dot com
@ 2013-02-19 18:58 ` argentinator.gcc.questions at outlook dot com
2013-02-19 21:52 ` joseph at codesourcery dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: argentinator.gcc.questions at outlook dot com @ 2013-02-19 18:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
--- Comment #5 from argentinator.gcc.questions at outlook dot com 2013-02-19 18:58:17 UTC ---
(In reply to comment #4)
> This looks like it's just an issue with the diagnostic text
> (binary_op_error being called with the type in which the floating-point
> operand is being represented, rather than with its semantic type).
Is this "type/semantic type" issue related to the following observation?
I tried to print the value of fpclassify for a 'subnormal' value whose type is
'float' or 'double', but it seems the compiler considers everything as a 'long
double'. The source code would be:
------------------------------------------------------------------------------
#include <math.h>
#include <float.h>
#include <stdio.h>
int main(void) {
double x = DBL_MIN / 1024.0;
long double z = LDBL_MIN / 1024.0;
printf("x == %a\n\nClass of x == %X\n\nClass of z == %X\n",
x, fpclassify(x), fpclassify(z));
}
------------------------------------------------------------------------------
(As always, I am running on Windows 7, MinGW, GCC 4.7.2,
command line option -std=c99, and I have FLT_EVAL_METHOD == 2).
My output is:
------------------------
x == 0x8p-1035 /* This is a 'double subnormal' value */
Class of x == 400 /* x is 'double' and normal, so this seems wrong */
Class of z == 4400 /* z is 'long double' and 'subnormal': OK */
------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/56397] Floating Point constant in C, with standard C99
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
` (4 preceding siblings ...)
2013-02-19 18:58 ` argentinator.gcc.questions at outlook dot com
@ 2013-02-19 21:52 ` joseph at codesourcery dot com
2013-02-19 22:02 ` argentinator.gcc.questions at outlook dot com
2013-02-20 9:33 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: joseph at codesourcery dot com @ 2013-02-19 21:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2013-02-19 21:51:56 UTC ---
On Tue, 19 Feb 2013, argentinator.gcc.questions at outlook dot com wrote:
> I tried to print the value of fpclassify for a 'subnormal' value whose type is
> 'float' or 'double', but it seems the compiler considers everything as a 'long
> double'. The source code would be:
fpclassify is a matter for your C library, not for GCC, so report such
issues there.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/56397] Floating Point constant in C, with standard C99
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
` (5 preceding siblings ...)
2013-02-19 21:52 ` joseph at codesourcery dot com
@ 2013-02-19 22:02 ` argentinator.gcc.questions at outlook dot com
2013-02-20 9:33 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: argentinator.gcc.questions at outlook dot com @ 2013-02-19 22:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
--- Comment #7 from argentinator.gcc.questions at outlook dot com 2013-02-19 22:01:16 UTC ---
(In reply to comment #6)
> On Tue, 19 Feb 2013, argentinator.gcc.questions at outlook dot com wrote:
>
> > I tried to print the value of fpclassify for a 'subnormal' value whose type is
> > 'float' or 'double', but it seems the compiler considers everything as a 'long
> > double'. The source code would be:
>
> fpclassify is a matter for your C library, not for GCC, so report such
> issues there.
Sorry :(
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c/56397] Floating Point constant in C, with standard C99
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
` (6 preceding siblings ...)
2013-02-19 22:02 ` argentinator.gcc.questions at outlook dot com
@ 2013-02-20 9:33 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-20 9:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56397
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-02-20
Ever Confirmed|0 |1
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-20 09:33:37 UTC ---
Confirmed as a diagnostic issue.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-02-20 9:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19 14:37 [Bug c/56397] New: Floating Point constant in C, with standard C99 argentinator.gcc.questions at outlook dot com
2013-02-19 15:13 ` [Bug c/56397] " redi at gcc dot gnu.org
2013-02-19 16:57 ` argentinator.gcc.questions at outlook dot com
2013-02-19 17:10 ` redi at gcc dot gnu.org
2013-02-19 17:11 ` joseph at codesourcery dot com
2013-02-19 18:58 ` argentinator.gcc.questions at outlook dot com
2013-02-19 21:52 ` joseph at codesourcery dot com
2013-02-19 22:02 ` argentinator.gcc.questions at outlook dot com
2013-02-20 9:33 ` rguenth at gcc dot gnu.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).