When float_t and double_t types are used inside a scope with a '#pragma clang fp eval_method', it can lead to ABI breakage.
See https://godbolt.org/z/56zG4Wo91
This patch prevents this.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
abi-check is a really generic name for a test case; could you rename those three tests to something more specific to this feature? Also, your tests are only testing this behavior in C++.
Patch functionality LGTM.
Comment Actions
This change causes test regressions on 32-bit x86:
FAIL: Clang :: Sema/fp-eval-pragma-with-float-double_t-3.c (14665 of 17845) ******************** TEST 'Clang :: Sema/fp-eval-pragma-with-float-double_t-3.c' FAILED ******************** Script: -- : 'RUN: at line 1'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -verify -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c : 'RUN: at line 2'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c : 'RUN: at line 4'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=extended -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c : 'RUN: at line 5'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=extended -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c : 'RUN: at line 8'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=source /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c : 'RUN: at line 9'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=source /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c : 'RUN: at line 11'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=double /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c : 'RUN: at line 12'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=double /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c -- Exit Code: 1 Command Output (stderr): -- + : 'RUN: at line 1' + /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -verify -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c error: 'warning' diagnostics seen but not expected: File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c Line 36: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c Line 43: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c Line 50: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c Line 59: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c Line 66: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c Line 72: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c Line 78: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-3.c Line 85: Setting the floating point evaluation method to `source` on a target without SSE is not supported. 8 errors generated. -- FAIL: Clang :: Sema/fp-eval-pragma-with-float-double_t-1.c (14667 of 17845) ******************** TEST 'Clang :: Sema/fp-eval-pragma-with-float-double_t-1.c' FAILED ******************** Script: -- : 'RUN: at line 1'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c : 'RUN: at line 2'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c : 'RUN: at line 4'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=source -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c : 'RUN: at line 5'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=source -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c : 'RUN: at line 8'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=double /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c : 'RUN: at line 9'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=double /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c : 'RUN: at line 11'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=extended /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c : 'RUN: at line 12'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=extended /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c -- Exit Code: 1 Command Output (stderr): -- + : 'RUN: at line 1' + /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c error: 'warning' diagnostics seen but not expected: File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c Line 37: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c Line 44: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c Line 51: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c Line 60: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c Line 67: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c Line 73: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c Line 79: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-1.c Line 86: Setting the floating point evaluation method to `source` on a target without SSE is not supported. 8 errors generated. -- ******************** FAIL: Clang :: Sema/fp-eval-pragma-with-float-double_t-2.c (14668 of 17845) ******************** TEST 'Clang :: Sema/fp-eval-pragma-with-float-double_t-2.c' FAILED ******************** Script: -- : 'RUN: at line 1'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c : 'RUN: at line 2'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c : 'RUN: at line 4'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=double -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c : 'RUN: at line 5'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=double -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c : 'RUN: at line 7'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=source /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c : 'RUN: at line 8'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=source /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c : 'RUN: at line 10'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -ffp-eval-method=extended /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c : 'RUN: at line 11'; /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -x c++ -DCPP -ffp-eval-method=extended /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c -- Exit Code: 1 Command Output (stderr): -- + : 'RUN: at line 1' + /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/clang -cc1 -internal-isystem /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/x/y/clang-abi_x86_32.x86/bin/../../../../lib/clang/17/include -nostdsysteminc -verify -fsyntax-only -DNOERROR /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c error: 'warning' diagnostics seen but not expected: File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c Line 34: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c Line 41: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c Line 48: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c Line 57: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c Line 64: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c Line 70: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c Line 76: Setting the floating point evaluation method to `source` on a target without SSE is not supported. File /var/tmp/portage/sys-devel/clang-17.0.0_pre20230624/work/clang/test/Sema/fp-eval-pragma-with-float-double_t-2.c Line 83: Setting the floating point evaluation method to `source` on a target without SSE is not supported. 8 errors generated. -- ********************