middle-end/90648 fend off builtin calls with not enough arguments from match
authorRichard Biener <rguenther@suse.de>
Wed, 5 Feb 2020 13:04:29 +0000 (14:04 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 5 Feb 2020 13:06:40 +0000 (14:06 +0100)
commit1105cf8163f635ac4e4a3357d8b16a73fb6aced5
treebeb7961773473aa15a76c9261cda280e556e7e02
parent5f44a4341cf9793ccfb28cb0ab6876174c0d89dc
middle-end/90648 fend off builtin calls with not enough arguments from match

This adds guards to genmatch generated code before accessing call
expression or stmt arguments that might be out of bounds when
the user provided bogus prototypes for what we consider builtins.

2020-02-05  Richard Biener  <rguenther@suse.de>

PR middle-end/90648
* genmatch.c (dt_node::gen_kids_1): Emit number of argument
checks before matching calls.

* gcc.dg/pr90648.c: New testcase.
gcc/ChangeLog
gcc/genmatch.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr90648.c [new file with mode: 0644]