-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.compiler-rt:ubsanUndefined behavior sanitizerUndefined behavior sanitizercrash-on-validfloating-pointFloating-point mathFloating-point math
Description
The following code crashes clang 21.1.4 on Fedora Linux 43 on Intel x86_64
#include <assert.h> /* assert */
#include <stddef.h> /* offsetof */
#include <float.h> /* FLT_SNAN */
#include <complex.h> /* FLT_CMPLX */
#include <wchar.h> /* wchar_t */
#include <stdio.h> /* printf */
static float complex f2cx;
static double complex d2cx;
static long double complex ld2cx;
static struct bit2 {
unsigned int uibf : 7;
signed int sibf : 7;
int pibf : 7;
bool bobf : 1;
unsigned char after[16];
} bits = { 1u, 1, 1, 1 };
int main(void){
if(1){
struct bit2 res;
res.bobf = bits.bobf /= CMPLXF( .125f, .125f );
res.bobf = bits.bobf /= f2cx;
res.bobf = bits.bobf /= CMPLX( .125, .125 );
res.bobf = bits.bobf /= d2cx;
res.bobf = bits.bobf /= CMPLXL( .125L, .125L );
res.bobf = bits.bobf /= ld2cx;
}
return 0;
}- Program arguments: clang -g -fsanitize=memory -fsanitize=undefined -fno-sanitize=float-cast-overflow -fno-sanitize=float-divide-by-zero -H -std=c23 -m64 -mfpmath=sse -msse2 -pedantic -O0 -fno-fast-math -fdenormal-fp-math=ieee -fstrict-float-cast-overflow -fmath-errno -ftrapping-math -ffp-contract=on -fhonor-infinities -fhonor-nans -fsigned-zeros -fno-associative-math -fno-reciprocal-math -fno-unsafe-math-optimizations -fno-finite-math-only -frounding-math -ffp-model=strict -ffp-exception-behavior=strict -Xclang -disable-llvm-optzns -I/lindata/fpcets/clang64/2114/csse// -I/lindata/fpcets/common/ -I/lindata/fpcets/real/ -I/lindata/fpcets/real/bin/ -I/lindata/fpcets/real/bin/io/ -I/lindata/fpcets/cmplx/ -Wno-literal-range -Wno-unknown-pragmas -c test190.c
- parser at end of file
- Code generation
- Running pass 'Function Pass Manager' on module 'test190.c'.
- Running pass 'X86 DAG->DAG Instruction Selection' on function '
@main'
Metadata
Metadata
Assignees
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.compiler-rt:ubsanUndefined behavior sanitizerUndefined behavior sanitizercrash-on-validfloating-pointFloating-point mathFloating-point math