[llvm-bugs] [Bug 52494] New: #pragma STDC CX_LIMITED_RANGE ON occurring in invalid place: missing diagnostics

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 12 14:16:02 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=52494

            Bug ID: 52494
           Summary: #pragma STDC CX_LIMITED_RANGE ON occurring in invalid
                    place: missing diagnostics
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pavel.morozkin at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

int main(void)
{
    int i;
#pragma STDC FENV_ACCESS OFF
#pragma STDC CX_LIMITED_RANGE ON
#pragma STDC FP_CONTRACT OFF
    return 0;
}

-std=c11 -pedantic -Wall -Wextra

<source>:42:14: error: '#pragma STDC FENV_ACCESS' can only appear at file scope
or at the start of a compound statement
#pragma STDC FENV_ACCESS OFF
             ^
<source>:44:14: error: '#pragma fp_contract' can only appear at file scope or
at the start of a compound statement
#pragma STDC FP_CONTRACT OFF

Why no error for "#pragma STDC CX_LIMITED_RANGE"?

C11:
- 7.3.4 The CX_LIMITED_RANGE pragma:
> The pragma can occur either outside external declarations or preceding all explicit declarations and statements inside a compound statement.
- 7.12.2 The FP_CONTRACT pragma:
> Each pragma can occur either outside external declarations or preceding all explicit declarations and statements inside a compound statement. 
- 7.6.1 The FENV_ACCESS pragma:
> The pragma shall occur either outside external declarations or preceding all explicit declarations and statements inside a compound statement.


Here we see that the text for CX_LIMITED_RANGE and for FP_CONTRACT is almost
the same (except "each" vs. "the"). Hence, it is expected that the diagnostics
is the same.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211112/14d15ecf/attachment.html>


More information about the llvm-bugs mailing list