[ET Trac] #2052: piraha assumes that assert(false) always aborts

Steven R. Brandt trac-noreply at einsteintoolkit.org
Thu Oct 9 11:13:27 CDT 2025


#2052: piraha assumes that assert(false) always aborts

 Reporter: Roland Haas
   Status: resolved
Milestone: 
  Version: development version
     Type: bug
 Priority: minor
Component: Cactus

Changes (by Steven R. Brandt):

status: resolved (was open)

I recently tried compiling Cactus with the Cray compiler on BW and get (among other things) warnings like this:

    CC-940 crayc++: WARNING File = src/piraha/Piraha.hpp, Line = 326
      A "return" statement is missing from the end of a non-void function
              "cctki_piraha::LookAhead::match".
    
          bool match(Matcher *m) { assert(false); }//TODO: Fill in
which is indeed a bug. If one defines NDEBUG (as is done for the highly optimized option lists) then assert() is a no-op and the function (if it was called) returned garbage.

I see three solutions:

1. call CCTK_Abort()
1. add a "return false;" or so
1. remove the whole function definition. I think C++ does not mind if declared member functions of a class are not defined, just so long as they are never actually called. This would have the advantage of generating a compile time error as well rather than a run-time error.

**Keyword:** piraha
Comment (by Steven R. Brandt):

Applied previously.

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2052/piraha-assumes-that-assert-false-always
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.einsteintoolkit.org/pipermail/trac/attachments/20251009/5711895c/attachment.htm>


More information about the Trac mailing list