llvm / llvm/llvm-project

#pragma STDC FENV_ROUND FE_TONEAREST gives misleading warning

Open
#173,098 6 comments 0 reactions 0 assignees View on GitHub
clang:diagnostics
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The statement:
#pragma STDC FENV_ROUND FE_TONEAREST

Gets:
warning: expected identifier in '#pragma FENV_ROUND' - ignored [-Wignored-pragmas]
which is misleading.

1) The 'STDC' got dropped in the message.
2) FE_TONEAREST is a valid 'direction' as per the C standard.

If the pragma is not supported, the warning should say so.
If the pragma is supported, there should be no warning.

Contributor guide

Open the contributing guide

Research direction

Start by searching the compiler diagnostics for “expected identifier in '#pragma FENV_ROUND'” and the handling of #pragma STDC FENV_ROUND. Check the relevant compiler tests, if found alongside that implementation. Done means the diagnostic preserves STDC and accurately reports unsupported pragmas, or the valid FE_TONEAREST form is accepted without a warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.