This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
pointers to variable-length arrays - undefined behavior sanitizer
- From: "Uecker, Martin" <Martin dot Uecker at med dot uni-goettingen dot de>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Cc: "joseph at codesourcery dot com" <joseph at codesourcery dot com>, "polacek at redhat dot com" <polacek at redhat dot com>
- Date: Tue, 27 Mar 2018 16:30:39 +0000
- Subject: pointers to variable-length arrays - undefined behavior sanitizer
Hi,
I want to add run-time support for checking for equality of
the size expressions where pointers to variable-length arrays
are required to be compatible.
I wonder if you could give some advise on how to approach
this. One general question is where this should be added.
For example, I think it would be easy to instrument
function calls in gcc/ubsan.c . My initial attempt does
not work though because accessing the size expressions
seems to confuse the SSA renaming (or so I think). But maybe
it would be better to add this in the frontend anyway.
One could add additional options for comptypes and similar
functions to return an instrument_expr (similar to
pointer_diff) and use this when building the relevant
expressions. Any thoughts or advise would be highly
appreciated.
Martin