public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-15 21:30 ` pinskia at gcc dot gnu.org
  2021-11-03 10:47 ` pavel.morozkin at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-15 21:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I have idea on how to fix the FENV_ACCESS issue (for gimple), basically you add
an extra virtual use op for float gimples and virtual define for functions and
inline-asm. Now I am not going to implement this but I want to record it
somewhere.

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
  2021-09-15 21:30 ` [Bug c/20785] Pragma STDC * (C99 FP) unimplemented pinskia at gcc dot gnu.org
@ 2021-11-03 10:47 ` pavel.morozkin at gmail dot com
  2021-11-03 12:43 ` vincent-gcc at vinc17 dot net
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pavel.morozkin at gmail dot com @ 2021-11-03 10:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

Pavel M <pavel.morozkin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pavel.morozkin at gmail dot com

--- Comment #12 from Pavel M <pavel.morozkin at gmail dot com> ---
As far as I understand, support of #pragma STDC xxx is required by the C
standard for hosted implementation. If so, then it is worth reaching
conformance to increase the priority of this issue. It is logical for the end
users to expect the support of  #pragma STDC xxx. Now they see:
t888.c:3: warning: ignoring ‘#pragma STDC FP_CONTRACT’ [-Wunknown-pragmas]
t888.c:4: warning: ignoring ‘#pragma STDC FENV_ACCESS’ [-Wunknown-pragmas]
t888.c:5: warning: ignoring ‘#pragma STDC CX_LIMITED_RANGE’ [-Wunknown-pragmas]
Invoked with: gcc t888.c -c -std=c11 -Wall.

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
  2021-09-15 21:30 ` [Bug c/20785] Pragma STDC * (C99 FP) unimplemented pinskia at gcc dot gnu.org
  2021-11-03 10:47 ` pavel.morozkin at gmail dot com
@ 2021-11-03 12:43 ` vincent-gcc at vinc17 dot net
  2021-11-08 11:20 ` pavel.morozkin at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2021-11-03 12:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

--- Comment #13 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
If the default state of these pragmas (at least with options like -std=c11) is
respectively "off", "on", "off", then changing the pragma state can safely be
ignored by the implementation, as implementations are not obliged to optimize
as allowed by the new pragma state. Thus, in such a case, the warnings are
useless.

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-11-03 12:43 ` vincent-gcc at vinc17 dot net
@ 2021-11-08 11:20 ` pavel.morozkin at gmail dot com
  2021-11-08 12:30 ` vincent-gcc at vinc17 dot net
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pavel.morozkin at gmail dot com @ 2021-11-08 11:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

--- Comment #14 from Pavel M <pavel.morozkin at gmail dot com> ---
To: Vincent Lefèvre
Re: the warnings are useless.

The "warning: ignoring '#pragma STDC FENV_ACCESS' [-Wunknown-pragmas]" probably
needs to be generated by default (i.e. not with -Wall) because now gcc silently
miscompiles the following (though unusual) code:
/* t0.c */
#include <stdio.h>
#include <fenv.h>
#include <float.h>

#pragma STDC FENV_ACCESS ON

int main( void )
{
    volatile double d1 = DBL_MAX;
    volatile double d2 = DBL_MAX;

#ifdef __STDC__
    printf("__STDC__         %d\n", __STDC__);
#endif
#ifdef __STDC_VERSION__
    printf("__STDC_VERSION__ %ld\n", __STDC_VERSION__);
#endif
#ifdef __STDC_IEC_559__
    printf("__STDC_IEC_559__ %d\n", __STDC_IEC_559__);
#endif

    if (feclearexcept( FE_ALL_EXCEPT ) != 0)
    {
        printf("error: feclearexcept( FE_ALL_EXCEPT ) failed\n");
        return 1;
    }
    ( void )( d1 * d2 );
    if (fetestexcept( FE_OVERFLOW ) == 0)
    {
        printf("error: no FE_OVERFLOW is raised\n");
        return 2;
    }
    return 0;  ​
}

Invocation: gcc t0.c -std=c11 -pedantic -lm
<nothing>

Execution: ./a.out

Expected output:
__STDC__         1
__STDC_VERSION__ 201710
__STDC_IEC_559__ 1

Actual output:
__STDC__         1
__STDC_VERSION__ 201710
__STDC_IEC_559__ 1
error: no FE_OVERFLOW is raised

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-11-08 11:20 ` pavel.morozkin at gmail dot com
@ 2021-11-08 12:30 ` vincent-gcc at vinc17 dot net
  2021-11-12 22:02 ` pavel.morozkin at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2021-11-08 12:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

--- Comment #15 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Pavel M from comment #14)
> The "warning: ignoring '#pragma STDC FENV_ACCESS' [-Wunknown-pragmas]"
> probably needs to be generated by default

Getting the warning on "#pragma STDC FENV_ACCESS OFF" is useless. The issue
comes from the fact that the FENV_ACCESS is OFF by default and you want to set
it to ON; there should be a warning in this case, but only in this case.
Concerning the other pragmas, this also depends on their default state.

For instance, since commit 6dbe09581a1349498f6b4546f68cb9fd3205e120[*], the
STDC FP_CONTRACT pragma is set to OFF by default when a standard mode is
provided (e.g. -std=c17), so that the warning on this pragma is not needed in
this case (whether the user sets it to ON or OFF).

[*]
https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=6dbe09581a1349498f6b4546f68cb9fd3205e120

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-11-08 12:30 ` vincent-gcc at vinc17 dot net
@ 2021-11-12 22:02 ` pavel.morozkin at gmail dot com
  2021-11-13  0:39 ` vincent-gcc at vinc17 dot net
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pavel.morozkin at gmail dot com @ 2021-11-12 22:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

--- Comment #16 from Pavel M <pavel.morozkin at gmail dot com> ---
Note: The #pragma STDC FENV_ACCESS is unknown and ignored (leading to FP
issues), however, the __STDC_IEC_559__ is defined to 1. Confused.

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-11-12 22:02 ` pavel.morozkin at gmail dot com
@ 2021-11-13  0:39 ` vincent-gcc at vinc17 dot net
  2021-11-13 14:31 ` egallager at gcc dot gnu.org
  2024-05-01  0:04 ` rlcamp.pdx at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2021-11-13  0:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

--- Comment #17 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Pavel M from comment #16)
> Note: The #pragma STDC FENV_ACCESS is unknown and ignored (leading to FP
> issues), however, the __STDC_IEC_559__ is defined to 1. Confused.

Yes, and IMHO, with __STDC_IEC_559__ defined to 1, this is a much more severe
issue. This PR should not be regarded as an enhancement, but as a real bug
(this would be an enhancement only if when __STDC_IEC_559__ is defined to 1,
there would be a lack of optimization).

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2021-11-13  0:39 ` vincent-gcc at vinc17 dot net
@ 2021-11-13 14:31 ` egallager at gcc dot gnu.org
  2024-05-01  0:04 ` rlcamp.pdx at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-11-13 14:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

--- Comment #18 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Vincent Lefèvre from comment #17)
> (In reply to Pavel M from comment #16)
> > Note: The #pragma STDC FENV_ACCESS is unknown and ignored (leading to FP
> > issues), however, the __STDC_IEC_559__ is defined to 1. Confused.
> 
> Yes, and IMHO, with __STDC_IEC_559__ defined to 1, this is a much more
> severe issue. This PR should not be regarded as an enhancement, but as a
> real bug

OK, I put the importance back to "normal"

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2021-11-13 14:31 ` egallager at gcc dot gnu.org
@ 2024-05-01  0:04 ` rlcamp.pdx at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: rlcamp.pdx at gmail dot com @ 2024-05-01  0:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785

Campbell <rlcamp.pdx at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rlcamp.pdx at gmail dot com

--- Comment #19 from Campbell <rlcamp.pdx at gmail dot com> ---
Regardless of the wider issue, it would be nice to get STDC CX_LIMITED_RANGE
implemented. Is there something specific blocking this?

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

* [Bug c/20785] Pragma STDC * (C99 FP) unimplemented
       [not found] <bug-20785-8837@http.gcc.gnu.org/bugzilla/>
@ 2009-01-30  7:20 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-30  7:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-01-30 07:19 -------
*** Bug 39036 has been marked as a duplicate of this bug. ***


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tydeman at tybor dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20785


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

end of thread, other threads:[~2024-05-01  0:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-20785-4@http.gcc.gnu.org/bugzilla/>
2021-09-15 21:30 ` [Bug c/20785] Pragma STDC * (C99 FP) unimplemented pinskia at gcc dot gnu.org
2021-11-03 10:47 ` pavel.morozkin at gmail dot com
2021-11-03 12:43 ` vincent-gcc at vinc17 dot net
2021-11-08 11:20 ` pavel.morozkin at gmail dot com
2021-11-08 12:30 ` vincent-gcc at vinc17 dot net
2021-11-12 22:02 ` pavel.morozkin at gmail dot com
2021-11-13  0:39 ` vincent-gcc at vinc17 dot net
2021-11-13 14:31 ` egallager at gcc dot gnu.org
2024-05-01  0:04 ` rlcamp.pdx at gmail dot com
     [not found] <bug-20785-8837@http.gcc.gnu.org/bugzilla/>
2009-01-30  7:20 ` rguenth 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).