- changed status to open
- assigned issue to
- removed comment
piraha assumes that assert(false) always aborts
Issue #2052
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:
- call CCTK_Abort()
- add a "return false;" or so
- 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
Comments (8)
-
-
reporter @Steven R. Brandt any progress on this?
-
reporter hackathon (C++, piraha)
-
reporter @Steven R. Brandt any progress on this?
-
If by progress you mean had I forgotten about it? Then yes.
-
reporter :-)
-
Add PR https://bitbucket.org/cactuscode/cactus/pull-requests/154/fix-for-ticket-2052-replace-calls-to which replaces calls to assert(false) with CCTK_Error.
-
reporter Please apply.
- Log in to comment