[Bug c/83736] New: ICE triggered by improper use of VLA and scanf
czirkos.zoltan at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 8 11:51:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83736
Bug ID: 83736
Summary: ICE triggered by improper use of VLA and scanf
Product: gcc
Version: 7.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: czirkos.zoltan at gmail dot com
Target Milestone: ---
Created attachment 43059
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43059&action=edit
Compiler output
The following code causes an internal compiler error and segmentation fault in
the compiler:
#include <stdio.h>
int main(void){
int n = 0;
char temp[n + 1];
scanf("%s", &temp);
}
Of course the code is invalid (the address-of operator is not needed), but it
should not cause an ICE.
Attached compiler output.
Version is "gcc version 7.0.1 20170407 (experimental) [trunk revision 246759]
(Ubuntu 7-20170407-0ubuntu2)".
Command line is "gcc test.c".
The compiler also crashes if the call is not scanf but printf. And it also
crashes when all warnings are turned off (gcc -w).
More information about the Gcc-bugs
mailing list