Skip to content

Commit 9f14789

Browse files
committed
Fix: Prevent ICE on no input file
This patch adds a check in lang_dependent_init to detect when no input file is provided, issuing a fatal error instead of passing a NULL Pointer to downstream funcations. Fixes #3523 Signed-off-by: shreyas-omkar <[email protected]>
1 parent 5b5945a commit 9f14789

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gcc/toplev.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,11 @@ lang_dependent_init (const char *name)
19121912

19131913
if (!flag_wpa)
19141914
{
1915+
if (name == nullptr) {
1916+
fatal_error(input_location, "no input files");
1917+
return 0;
1918+
}
1919+
19151920
init_asm_output (name);
19161921

19171922
if (!flag_generate_lto && !flag_compare_debug)

0 commit comments

Comments
 (0)