]> gcc.gnu.org Git - gcc.git/commit
c: Error on va_arg with function type [PR105149]
authorJakub Jelinek <jakub@redhat.com>
Fri, 8 Apr 2022 07:16:30 +0000 (09:16 +0200)
committerJakub Jelinek <jakub@redhat.com>
Fri, 8 Apr 2022 07:16:30 +0000 (09:16 +0200)
commit6e2743687202c58a6553ae632ebbada3de38ad48
tree8585f448cb48560567f40090918b55b7f86a142f
parent5e6597064b0c7eb93b8f720afc4aa970eefb0628
c: Error on va_arg with function type [PR105149]

In the PR Joseph said that the C standard for va_arg talks about
pointers to object type and as a function type is not object type,
it is invalid.

The following patch diagnoses it in the FE, instead of ICEing later on
when optimizations are turned on (and with -O0 doing something weird
at runtime).

2022-04-08  Jakub Jelinek  <jakub@redhat.com>

PR c/105149
* c-typeck.cc (c_build_va_arg): Reject function types.

* gcc.dg/pr105149.c: New test.
gcc/c/c-typeck.cc
gcc/testsuite/gcc.dg/pr105149.c [new file with mode: 0644]
This page took 0.063375 seconds and 5 git commands to generate.