Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

Issue #1440

V3Ast.cpp gives warning with -Winvalid-noreturn

Added by Kevin Kiningham 7 days ago. Updated 7 days ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
Configure/Make/Compiling
% Done:

0%


Description

Compiling src/V3Ast.cpp produces the following warning when compiled with -Winvalid-noreturn (Apple LLVM version 10.0.0)

src/V3Ast.cpp:1070:92: warning: function declared 'noreturn' should not return [-Winvalid-noreturn]                                                                                                             
void AstNode::v3errorEndFatal(std::ostringstream& str) const { v3errorEnd(str); assert(0); }
                                                                                           ^

This is fixed pretty easily by adding VL_UNREACHABLE after the assert (patch attached). I'm not 100% sure that's the correct solution though, since assert may return if compiled with NDEBUG defined. Would it be better to turn the assert(0) into an abort()?

unreachable.patch View (534 Bytes) Kevin Kiningham, 05/14/2019 10:08 PM

History

#1 Updated by Wilson Snyder 7 days ago

  • Status changed from New to Closed

Your fix looks good, there were also two other similar sections of code I patched.

The assert will never get hit, as v3errorEnd exits before then. The assert is there to trick formal tools (that ignore the GNU attributes) into knowing the code is non-return.

Note Apple's LLVM 10.0.0 seems to have stuff not in the most recent clang++ 8.0 so there might be additional issues.

#2 Updated by Wilson Snyder 7 days ago

Pushed to git towards 4.016.

#3 Updated by Kevin Kiningham 7 days ago

Awesome, thanks for the clarification!

Also available in: Atom