On Fri, Jan 17, 2014 at 02:09:33AM -0000, Richard Smith wrote:
> Author: rsmith
> Date: Thu Jan 16 20:09:33 2014
> New Revision: 199452
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=199452&view=rev
> Log:
> Issue a warning if a throwing operator new or operator new[] returns a null
> pointer, since this invokes undefined behavior. Based on a patch by Artyom
> Skrobov! Handling of dependent exception specifications and some additional
> testcases by me.

OpenJDK contains code like

        void *foo::operator new(size_t, bar &, int, TRAPS) {
          if (error_condition)
            return 0;
          return some_value;
        }

Should this warning really apply here?

Another issue is that it doesn't check whether the return statement is
actually reachable, e.g. a __builtin_unreachable() just before it does
not silence the warning. I think it should.

Joerg
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to