Opened 19 months ago

Last modified 19 months ago

#2052 assigned defect

piraha assumes that assert(false) always aborts

Reported by: Roland Haas Owned by: Steven R. Brandt
Priority: minor Milestone:
Component: Cactus Version: development version
Keywords: piraha Cc:


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

      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()
  2. add a "return false;" or so
  3. 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.

Attachments (0)

Change History (1)

comment:1 Changed 19 months ago by Steven R. Brandt

Owner: set to Steven R. Brandt
Status: newassigned

Modify Ticket

Change Properties
Set your email in Preferences
as assigned The owner will remain Steven R. Brandt.
Next status will be 'review'.
as The resolution will be set.
to The owner will be changed from Steven R. Brandt to the specified user.
The owner will be changed from Steven R. Brandt to anonymous.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.