Skip to content

[clang][bytecode] Fix modify_global diagnostics in C++11 #108358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

tbaederr
Copy link
Contributor

We shouldn't emit this until C++14.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Sep 12, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 12, 2024

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

Changes

We shouldn't emit this until C++14.


Full diff: https://github.com/llvm/llvm-project/pull/108358.diff

2 Files Affected:

  • (modified) clang/lib/AST/ByteCode/Interp.cpp (+1-1)
  • (modified) clang/test/AST/ByteCode/cxx11.cpp (+5)
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 2fa8b40f6085ad..827a177f9bf830 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -883,7 +883,7 @@ bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
     return diagnoseUnknownDecl(S, OpPC, D);
 
   assert(AK == AK_Assign);
-  if (S.getLangOpts().CPlusPlus11) {
+  if (S.getLangOpts().CPlusPlus14) {
     const SourceInfo &E = S.Current->getSource(OpPC);
     S.FFDiag(E, diag::note_constexpr_modify_global);
   }
diff --git a/clang/test/AST/ByteCode/cxx11.cpp b/clang/test/AST/ByteCode/cxx11.cpp
index 481e3da9289efa..86b58283023bc8 100644
--- a/clang/test/AST/ByteCode/cxx11.cpp
+++ b/clang/test/AST/ByteCode/cxx11.cpp
@@ -169,3 +169,8 @@ namespace FinalLtorDiags {
   A<q> c; // both-error {{non-type template argument of type 'int *' is not a constant expression}} \
           // both-note {{read of non-constexpr variable 'q' is not allowed in a constant expression}}
 }
+
+void lambdas() {
+  int d;
+  int a9[1] = {[d = 0] = 1}; // both-error {{not an integral constant expression}}
+}

@tbaederr tbaederr merged commit f22a8d1 into llvm:main Sep 12, 2024
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 12, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-qemu running on sanitizer-buildbot4 while building clang at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/139/builds/3638

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure) (timed out)
...
[    5.101470] pci 0000:00:02.0: [8086:100e] type 00 class 0x020000 conventional PCI endpoint
[    5.103115] pci 0000:00:02.0: BAR 0 [mem 0xfebc0000-0xfebdffff]
[    5.107014] pci 0000:00:02.0: BAR 1 [io  0xc000-0xc03f]
[    5.113014] pci 0000:00:02.0: ROM [mem 0xfeb80000-0xfebbffff pref]
[    5.113014] pci 0000:00:1f.0: [8086:2918] type 00 class 0x060100 conventional PCI endpoint
[    5.119315] pci 0000:00:1f.0: quirk: [io  0x0600-0x067f] claimed by ICH6 ACPI/GPIO/TCO
[    5.122449] pci 0000:00:1f.2: [8086:2922] type 00 class 0x010601 conventional PCI endpoint
[    5.132014] pci 0000:00:1f.2: BAR 4 [io  0xc080-0xc09f]
[    5.133014] pci 0000:00:1f.2: BAR 5 [mem 0xfebf1000-0xfebf1fff]
+ ssh -p 11486 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlPersist=30m -M -S /home/b/sanitizer-x86_64-linux-qemu/build/qemu_tmp/ssh-control-socket -i /home/b/qemu_image/debian.id_rsa root@localhost 'uname -a'
command timed out: 1200 seconds without output running [b'python', b'../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=4408.964734
Step 29 (start LAM QEMU) failure: start LAM QEMU (failure)
...
[    4.681136] mtrr: your CPUs had inconsistent MTRRdefType settings
[    4.683083] mtrr: probably your BIOS does not setup all CPUs.
[    4.684075] mtrr: corrected configuration.
[    4.691024] kprobes: kprobe jump-optimization is enabled. All kprobes are optimized if possible.
[    4.717442] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    4.718014] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    4.745014] ACPI: Added _OSI(Module Device)
[    4.745117] ACPI: Added _OSI(Processor Device)
[    4.745356] ACPI: Added _OSI(3.0 _SCP Extensions)
[    4.745550] ACPI: Added _OSI(Processor Aggregator Device)
[    4.801487] ACPI: 1 ACPI AML tables successfully acquired and loaded
[    4.872789] ACPI: Interpreter enabled
[    4.878184] ACPI: PM: (supports S0 S3 S4 S5)
[    4.879014] ACPI: Using IOAPIC for interrupt routing
[    4.882014] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    4.884180] PCI: Using E820 reservations for host bridge windows
[    4.890660] ACPI: Enabled 2 GPEs in block 00 to 3F
[    5.026386] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    5.030489] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI HPX-Type3]
[    5.035664] acpi PNP0A08:00: _OSC: platform does not support [LTR]
[    5.038458] acpi PNP0A08:00: _OSC: OS now controls [PME PCIeCapability]
[    5.050211] PCI host bridge to bus 0000:00
[    5.052592] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    5.054149] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    5.054807] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    5.055060] pci_bus 0000:00: root bus resource [mem 0x80000000-0xafffffff window]
[    5.056071] pci_bus 0000:00: root bus resource [mem 0xc0000000-0xfebfffff window]
[    5.057066] pci_bus 0000:00: root bus resource [mem 0x480000000-0xc7fffffff window]
[    5.058262] pci_bus 0000:00: root bus resource [bus 00-ff]
[    5.066902] pci 0000:00:00.0: [8086:29c0] type 00 class 0x060000 conventional PCI endpoint
[    5.094114] pci 0000:00:01.0: [1234:1111] type 00 class 0x030000 conventional PCI endpoint
[    5.097192] pci 0000:00:01.0: BAR 0 [mem 0xfd000000-0xfdffffff pref]
[    5.099014] pci 0000:00:01.0: BAR 2 [mem 0xfebf0000-0xfebf0fff]
[    5.101014] pci 0000:00:01.0: ROM [mem 0xfebe0000-0xfebeffff pref]
[    5.101014] pci 0000:00:01.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    5.101470] pci 0000:00:02.0: [8086:100e] type 00 class 0x020000 conventional PCI endpoint
[    5.103115] pci 0000:00:02.0: BAR 0 [mem 0xfebc0000-0xfebdffff]
[    5.107014] pci 0000:00:02.0: BAR 1 [io  0xc000-0xc03f]
[    5.113014] pci 0000:00:02.0: ROM [mem 0xfeb80000-0xfebbffff pref]
[    5.113014] pci 0000:00:1f.0: [8086:2918] type 00 class 0x060100 conventional PCI endpoint
[    5.119315] pci 0000:00:1f.0: quirk: [io  0x0600-0x067f] claimed by ICH6 ACPI/GPIO/TCO
[    5.122449] pci 0000:00:1f.2: [8086:2922] type 00 class 0x010601 conventional PCI endpoint
[    5.132014] pci 0000:00:1f.2: BAR 4 [io  0xc080-0xc09f]
[    5.133014] pci 0000:00:1f.2: BAR 5 [mem 0xfebf1000-0xfebf1fff]
+ ssh -p 11486 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlPersist=30m -M -S /home/b/sanitizer-x86_64-linux-qemu/build/qemu_tmp/ssh-control-socket -i /home/b/qemu_image/debian.id_rsa root@localhost 'uname -a'

command timed out: 1200 seconds without output running [b'python', b'../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=4408.964734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants