This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix undefined behaviors in regex


On Thu, Oct 17, 2013 at 09:12:41AM +0200, Marek Polacek wrote:
> On Wed, Oct 16, 2013 at 07:02:03PM -0400, Tim Shen wrote:
> > > To be honest, I was thinking something much smaller than the whole <regex>
> > > ;) But let's add Marek in CC.
> > 
> > int work() {
> > }
> > 
> > int main() {
> >     int a = work();
> >     return a;
> > }
> > 
> > /* This is a smaller case to test the sanitizer. It seems that the
> > undefined sanitizer is not merged? I use `g++ (GCC) 4.9.0 20131003`,
> > is that too old? */
> 
> No, that's not too old, the thing is -fsanitize=undefined isn't
> complete - we currently sanitize shift, division by zero, and
> __builtin_unreachable call; VLA sanitization is done, but not commited
> because I'm waiting for a review of the C++ FE part of that patch,
> and on NULL pointer checking I'm working now.
> 
> Missing return statement will definitely be added, too (quite
> easy, I should think), and that would detect the bug in your
> testcase.

Though, in the above case, the question is why people ignore warnings
from the compiler and need to have special runtime instrumentation to remind
them instead.  I'm not objecting to that sanitization, only find it weird.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]