- 
                Notifications
    
You must be signed in to change notification settings  - Fork 472
 
Fix handling of int<0> constants, fix warning category #5249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
c2956c5    to
    08069e4      
    Compare
  
    5038bd6    to
    91ed8be      
    Compare
  
    | 
           How can such values appear?  | 
    
          
 Altera backend certainly hits it. It might not be directly from the code, but I think even a manual creation of such constant must not trigger exception in boost.  | 
    
Signed-off-by: Vladimír Štill <[email protected]>
Signed-off-by: Vladimír Štill <[email protected]>
Signed-off-by: Vladimír Štill <[email protected]>
Signed-off-by: Vladimír Štill <[email protected]>
Signed-off-by: Vladimír Štill <[email protected]>
Signed-off-by: Vladimír Štill <[email protected]>
e06daee    to
    59be003      
    Compare
  
    
          
 I am actually thinking, if creation of such types is a result of some underlying issue? Shouldn't   | 
    
          
 Section 7.1.6.2 "Unsigned integers (bit-strings)" of the P4 language spec includes this sentence: "Bitstrings with width 0 are allowed; they have no actual bits, and can only have the value 0." This was added to the language spec in Apr 2021 from some git log searches. For type   | 
    
          
 
 where  
  | 
    
          
 Then probably the meaning should be clarified? Should the spec explicitly say that   | 
    
| if (tb->isSigned) { | ||
| if (width == 0) { | ||
| if (value != 0 && !noWarning) { | ||
| P4::warning(ErrorType::WARN_OVERFLOW, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use warning instead of P4::warning for consistency with below.
Fixes a crash when the compiler tries to create
int<0>constant:Also fixes the warning category of
bit<N>overflow (which wasmismatchand now isoverflow).