[haiku-bugs] Re: [Haiku] #10803: gcc wrongly optimizes NULL check in strdup.

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Wed, 30 Apr 2014 13:19:31 -0000

#10803: gcc wrongly optimizes NULL check in strdup.
---------------------------------+----------------------------
   Reporter:  pulkomandy         |      Owner:  axeld
       Type:  bug                |     Status:  new
   Priority:  normal             |  Milestone:  R1
  Component:  System/libroot.so  |    Version:  R1/Development
 Resolution:                     |   Keywords:
 Blocked By:                     |   Blocking:
Has a Patch:  0                  |   Platform:  All
---------------------------------+----------------------------

Comment (by pulkomandy):

 I understood why the issue popped up for me: I didn't re-run configure
 following the clang support changes. So HAIKU_CC_IS_CLANG is not properly
 set here, and there is a guard preventing -fno-tree-vrp to be added to the
 flags.

 Anyway, shouldn't we enable tree-vrp and disable the built-in strdup
 instead? It sounds like things would crash if they use the builtin, no
 matter if the optimization is enabled.

 I don't see anything in the POSIX spec that explicitly disallows handling
 NULL pointers. There's the possible performance problem, still, which may
 be a valid reason for omitting it...

--
Ticket URL: <https://dev.haiku-os.org/ticket/10803#comment:5>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: