checkedc / checkedc-llvm-project

This was a fork of Checked C clang used from 2021-2024. The changes have been merged into the original Checked C clang repo, which is now at https://github.com/checkedc/checkedc-clang.
https://www.checkedc.org
13 stars 19 forks source link

Rogue semi-colon causes clang to crash. #1195

Closed souragc closed 1 year ago

souragc commented 2 years ago

Code:

# 1 "<built-in>"
# 1 "crash.c"
#pragma CHECKED_SCOPE on

void crash( char * arg )
{
    ;
    if( arg )
    {
    }
}

Command to reproduce:

# Crash reproducer for clang version 12.0.0 (https://github.com/secure-sw-dev/checkedc-llvm-project.git 107dee359fa7b332fef3d8f2d538c2ee9a8a3281)
# Driver args: "crash.c"
# Original command:  "/home/user/Desktop/default/checkedc-llvm-project/build/bin/clang-12" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-main-file-name" "crash.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-resource-dir" "/home/user/Desktop/default/checkedc-llvm-project/build/lib/clang/12.0.0" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/home/user/Desktop/default/checkedc-llvm-project/build/lib/clang/12.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdebug-compilation-dir" "/home/user/Desktop/default/checkedc-llvm-project/build/bin" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-faddrsig" "-o" "/tmp/crash-d8209a.o" "-x" "c" "crash.c"
 "/home/user/Desktop/default/checkedc-llvm-project/build/bin/clang-12" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-main-file-name" "crash.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-faddrsig" "-x" "c" "crash-ceb21f.c"
arunkumarbhattar commented 1 year ago

Merged the pull request