[ET Trac] [Einstein Toolkit] #1571: incorrect use of CCTK_BUILTIN_UNREACHABLE in Carpet
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Tue Apr 1 19:54:49 CDT 2014
#1571: incorrect use of CCTK_BUILTIN_UNREACHABLE in Carpet
--------------------+-------------------------------------------------------
Reporter: rhaas | Owner: eschnett
Type: defect | Status: new
Priority: major | Milestone:
Component: Carpet | Version: development version
Keywords: |
--------------------+-------------------------------------------------------
Carpet in commit fc35c561a049d905763de37d60690fc15473d65d "CarpetLib: Some
harmless code cleanup" (sic) replaced some assert(0) by
CCTK_BUILTIN_UNREACHABLE().
One of those (in the switch in transfer_p_r in line 730 of data.cc) was
just found by Zach Etienne to cause segfaults if one does not properly add
a new interpolation operator.
The difference is that CCTK_BUILTIN_UNREACHABLE() tells the compiler that
a given line of code will never be reached thus the compiler can optimize
it away. assert(0) on the other hand makes no such statement, it just
aborts if it is reached. This error is compiler dependent since
CCTK_BUILTIN_UNREACHABLE() expands to CCTK_Abort(0,1) unless the compiler
supports __builtin_unreachable.
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1571>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list