[clang] [Wunsafe-buffer-usage] Fix false positive when const sized array is indexed by const evaluatable expressions (PR #119340)
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 16 06:21:20 PST 2025
nico wrote:
This makes clang assert on many inputs. Here's a repro:
[repro.zip](https://github.com/user-attachments/files/18440860/repro.zip)
```
% ./input_file_parsers-161259.sh
...
Assertion failed: (!isValueDependent() && "Expression evaluator can't be called on a dependent expression."), function EvaluateAsInt, file ExprConstant.cpp, line 16671.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /Users/thakis/src/llvm-project/out/gn/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj --crel -disable-free -clear-ast-before-backend -main-file-name input_file_parsers.cc -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fmerge-all-constants -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -target-feature +sse3 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -ggnu-pubnames -gsimple-template-names=simple -mllvm -generate-arange-section -debug-forward-template-params -fdebug-compilation-dir=. -split-dwarf-file tmp.dwo -split-dwarf-output tmp.dwo -mllvm -crash-diagnostics-dir=../../tools/clang/crashreports -ffunction-sections -fdata-sections -fno-unique-section-names -fcoverage-compilation-dir=. -nostdinc++ -O2 -std=c++20 -fdeprecated-macro -ferror-limit 19 -fvisibility=hidden -fvisibility-inlines-hidden -fwrapv -pthread -stack-protector 1 -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fno-sized-deallocation -Qn -fcolor-diagnostics -vectorize-loops -vectorize-slp -fuse-ctor-homing -mllvm -instcombine-lower-dbg-declare=0 -mllvm -split-threshold-for-reg-with-hint=0 -fcomplete-member-pointers -faddrsig -x c++ input_file_parsers-161259.cpp -Wno-gnu-line-marker -Wunsafe-buffer-usage
1. <eof> parser at end of file
```
https://github.com/llvm/llvm-project/pull/119340
More information about the cfe-commits
mailing list