C++: Add tests for assertions in release builds.

This commit is contained in:
Mathias Vorreiter Pedersen
2026-01-09 19:22:37 +00:00
parent 44089d84a3
commit 6e3fd25b09
4 changed files with 773 additions and 0 deletions

View File

@@ -25131,6 +25131,438 @@ ir.cpp:
# 2823| Type = [ArrayType] int[]
# 2823| ValueCategory = lvalue
# 2824| getStmt(5): [ReturnStmt] return ...
# 2830| [TopLevelFunction] void test_assert_simple(int, int, unsigned int, int)
# 2830| <params>:
# 2830| getParameter(0): [Parameter] x
# 2830| Type = [IntType] int
# 2830| getParameter(1): [Parameter] y
# 2830| Type = [IntType] int
# 2830| getParameter(2): [Parameter] u
# 2830| Type = [IntType] unsigned int
# 2830| getParameter(3): [Parameter] shadowed
# 2830| Type = [IntType] int
# 2830| getEntryPoint(): [BlockStmt] { ... }
# 2831| getStmt(0): [ExprStmt] ExprStmt
# 2831| getExpr(): [Literal] 0
# 2831| Type = [IntType] int
# 2831| Value = [Literal] 0
# 2831| ValueCategory = prvalue
# 2831| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2831| Type = [VoidType] void
# 2831| ValueCategory = prvalue
# 2831| getExpr(): [CStyleCast] (void)...
# 2831| Conversion = [VoidConversion] conversion to void
# 2831| Type = [VoidType] void
# 2831| ValueCategory = prvalue
# 2832| getStmt(1): [ExprStmt] ExprStmt
# 2832| getExpr(): [Literal] 0
# 2832| Type = [IntType] int
# 2832| Value = [Literal] 0
# 2832| ValueCategory = prvalue
# 2832| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2832| Type = [VoidType] void
# 2832| ValueCategory = prvalue
# 2832| getExpr(): [CStyleCast] (void)...
# 2832| Conversion = [VoidConversion] conversion to void
# 2832| Type = [VoidType] void
# 2832| ValueCategory = prvalue
# 2833| getStmt(2): [ExprStmt] ExprStmt
# 2833| getExpr(): [Literal] 0
# 2833| Type = [IntType] int
# 2833| Value = [Literal] 0
# 2833| ValueCategory = prvalue
# 2833| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2833| Type = [VoidType] void
# 2833| ValueCategory = prvalue
# 2833| getExpr(): [CStyleCast] (void)...
# 2833| Conversion = [VoidConversion] conversion to void
# 2833| Type = [VoidType] void
# 2833| ValueCategory = prvalue
# 2835| getStmt(3): [EmptyStmt] ;
# 2837| getStmt(4): [ExprStmt] ExprStmt
# 2837| getExpr(): [Literal] 0
# 2837| Type = [IntType] int
# 2837| Value = [Literal] 0
# 2837| ValueCategory = prvalue
# 2837| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2837| Type = [VoidType] void
# 2837| ValueCategory = prvalue
# 2837| getExpr(): [CStyleCast] (void)...
# 2837| Conversion = [VoidConversion] conversion to void
# 2837| Type = [VoidType] void
# 2837| ValueCategory = prvalue
# 2839| getStmt(5): [BlockStmt] { ... }
# 2840| getStmt(0): [DeclStmt] declaration
# 2840| getDeclarationEntry(0): [VariableDeclarationEntry] definition of shadowed
# 2840| Type = [IntType] int
# 2840| getVariable().getInitializer(): [Initializer] initializer for shadowed
# 2840| getExpr(): [VariableAccess] x
# 2840| Type = [IntType] int
# 2840| ValueCategory = prvalue(load)
# 2841| getStmt(1): [ExprStmt] ExprStmt
# 2841| getExpr(): [Literal] 0
# 2841| Type = [IntType] int
# 2841| Value = [Literal] 0
# 2841| ValueCategory = prvalue
# 2841| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2841| Type = [VoidType] void
# 2841| ValueCategory = prvalue
# 2841| getExpr(): [CStyleCast] (void)...
# 2841| Conversion = [VoidConversion] conversion to void
# 2841| Type = [VoidType] void
# 2841| ValueCategory = prvalue
# 2843| getStmt(6): [ReturnStmt] return ...
# 2846| [TemplateFunction,TopLevelFunction] void test_assert_in_template<T>(T, int, unsigned int)
# 2846| <params>:
# 2846| getParameter(0): [Parameter] x
# 2846| Type = [TypeTemplateParameter] T
# 2846| getParameter(1): [Parameter] y
# 2846| Type = [IntType] int
# 2846| getParameter(2): [Parameter] u
# 2846| Type = [IntType] unsigned int
# 2846| getEntryPoint(): [BlockStmt] { ... }
# 2847| getStmt(0): [ExprStmt] ExprStmt
# 2847| getExpr(): [Literal] 0
# 2847| Type = [IntType] int
# 2847| Value = [Literal] 0
# 2847| ValueCategory = prvalue
# 2847| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2847| Type = [VoidType] void
# 2847| ValueCategory = prvalue
# 2847| getExpr(): [CStyleCast] (void)...
# 2847| Conversion = [VoidConversion] conversion to void
# 2847| Type = [VoidType] void
# 2847| ValueCategory = prvalue
# 2848| getStmt(1): [ExprStmt] ExprStmt
# 2848| getExpr(): [Literal] 0
# 2848| Type = [IntType] int
# 2848| Value = [Literal] 0
# 2848| ValueCategory = prvalue
# 2848| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2848| Type = [VoidType] void
# 2848| ValueCategory = prvalue
# 2848| getExpr(): [CStyleCast] (void)...
# 2848| Conversion = [VoidConversion] conversion to void
# 2848| Type = [VoidType] void
# 2848| ValueCategory = prvalue
# 2849| getStmt(2): [ExprStmt] ExprStmt
# 2849| getExpr(): [Literal] 0
# 2849| Type = [IntType] int
# 2849| Value = [Literal] 0
# 2849| ValueCategory = prvalue
# 2849| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2849| Type = [VoidType] void
# 2849| ValueCategory = prvalue
# 2849| getExpr(): [CStyleCast] (void)...
# 2849| Conversion = [VoidConversion] conversion to void
# 2849| Type = [VoidType] void
# 2849| ValueCategory = prvalue
# 2851| getStmt(3): [EmptyStmt] ;
# 2853| getStmt(4): [ExprStmt] ExprStmt
# 2853| getExpr(): [Literal] 0
# 2853| Type = [IntType] int
# 2853| Value = [Literal] 0
# 2853| ValueCategory = prvalue
# 2853| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2853| Type = [VoidType] void
# 2853| ValueCategory = prvalue
# 2853| getExpr(): [CStyleCast] (void)...
# 2853| Conversion = [VoidConversion] conversion to void
# 2853| Type = [VoidType] void
# 2853| ValueCategory = prvalue
# 2855| getStmt(5): [BlockStmt] { ... }
# 2856| getStmt(0): [DeclStmt] declaration
# 2856| getDeclarationEntry(0): [VariableDeclarationEntry] definition of shadowed
# 2856| Type = [IntType] int
# 2856| getVariable().getInitializer(): [Initializer] initializer for shadowed
# 2856| getExpr(): [VariableAccess] x
# 2856| Type = [TypeTemplateParameter] T
# 2856| ValueCategory = lvalue
# 2856| getExpr().getFullyConverted(): [CStyleCast] (int)...
# 2856| Type = [IntType] int
# 2856| ValueCategory = prvalue
# 2857| getStmt(1): [ExprStmt] ExprStmt
# 2857| getExpr(): [Literal] 0
# 2857| Type = [IntType] int
# 2857| Value = [Literal] 0
# 2857| ValueCategory = prvalue
# 2857| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2857| Type = [VoidType] void
# 2857| ValueCategory = prvalue
# 2857| getExpr(): [CStyleCast] (void)...
# 2857| Conversion = [VoidConversion] conversion to void
# 2857| Type = [VoidType] void
# 2857| ValueCategory = prvalue
# 2859| getStmt(6): [ExprStmt] ExprStmt
# 2859| getExpr(): [Literal] 0
# 2859| Type = [IntType] int
# 2859| Value = [Literal] 0
# 2859| ValueCategory = prvalue
# 2859| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2859| Type = [VoidType] void
# 2859| ValueCategory = prvalue
# 2859| getExpr(): [CStyleCast] (void)...
# 2859| Conversion = [VoidConversion] conversion to void
# 2859| Type = [VoidType] void
# 2859| ValueCategory = prvalue
# 2860| getStmt(7): [ReturnStmt] return ...
# 2846| [FunctionTemplateInstantiation,TopLevelFunction] void test_assert_in_template<int>(int, int, unsigned int)
# 2846| <params>:
# 2846| getParameter(0): [Parameter] x
# 2846| Type = [IntType] int
# 2846| getParameter(1): [Parameter] y
# 2846| Type = [IntType] int
# 2846| getParameter(2): [Parameter] u
# 2846| Type = [IntType] unsigned int
# 2846| getEntryPoint(): [BlockStmt] { ... }
# 2847| getStmt(0): [ExprStmt] ExprStmt
# 2847| getExpr(): [Literal] 0
# 2847| Type = [IntType] int
# 2847| Value = [Literal] 0
# 2847| ValueCategory = prvalue
# 2847| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2847| Type = [VoidType] void
# 2847| ValueCategory = prvalue
# 2847| getExpr(): [CStyleCast] (void)...
# 2847| Conversion = [VoidConversion] conversion to void
# 2847| Type = [VoidType] void
# 2847| ValueCategory = prvalue
# 2848| getStmt(1): [ExprStmt] ExprStmt
# 2848| getExpr(): [Literal] 0
# 2848| Type = [IntType] int
# 2848| Value = [Literal] 0
# 2848| ValueCategory = prvalue
# 2848| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2848| Type = [VoidType] void
# 2848| ValueCategory = prvalue
# 2848| getExpr(): [CStyleCast] (void)...
# 2848| Conversion = [VoidConversion] conversion to void
# 2848| Type = [VoidType] void
# 2848| ValueCategory = prvalue
# 2849| getStmt(2): [ExprStmt] ExprStmt
# 2849| getExpr(): [Literal] 0
# 2849| Type = [IntType] int
# 2849| Value = [Literal] 0
# 2849| ValueCategory = prvalue
# 2849| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2849| Type = [VoidType] void
# 2849| ValueCategory = prvalue
# 2849| getExpr(): [CStyleCast] (void)...
# 2849| Conversion = [VoidConversion] conversion to void
# 2849| Type = [VoidType] void
# 2849| ValueCategory = prvalue
# 2851| getStmt(3): [EmptyStmt] ;
# 2853| getStmt(4): [ExprStmt] ExprStmt
# 2853| getExpr(): [Literal] 0
# 2853| Type = [IntType] int
# 2853| Value = [Literal] 0
# 2853| ValueCategory = prvalue
# 2853| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2853| Type = [VoidType] void
# 2853| ValueCategory = prvalue
# 2853| getExpr(): [CStyleCast] (void)...
# 2853| Conversion = [VoidConversion] conversion to void
# 2853| Type = [VoidType] void
# 2853| ValueCategory = prvalue
# 2855| getStmt(5): [BlockStmt] { ... }
# 2856| getStmt(0): [DeclStmt] declaration
# 2856| getDeclarationEntry(0): [VariableDeclarationEntry] definition of shadowed
# 2856| Type = [IntType] int
# 2856| getVariable().getInitializer(): [Initializer] initializer for shadowed
# 2856| getExpr(): [VariableAccess] x
# 2856| Type = [IntType] int
# 2856| ValueCategory = prvalue(load)
# 2857| getStmt(1): [ExprStmt] ExprStmt
# 2857| getExpr(): [Literal] 0
# 2857| Type = [IntType] int
# 2857| Value = [Literal] 0
# 2857| ValueCategory = prvalue
# 2857| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2857| Type = [VoidType] void
# 2857| ValueCategory = prvalue
# 2857| getExpr(): [CStyleCast] (void)...
# 2857| Conversion = [VoidConversion] conversion to void
# 2857| Type = [VoidType] void
# 2857| ValueCategory = prvalue
# 2859| getStmt(6): [ExprStmt] ExprStmt
# 2859| getExpr(): [Literal] 0
# 2859| Type = [IntType] int
# 2859| Value = [Literal] 0
# 2859| ValueCategory = prvalue
# 2859| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2859| Type = [VoidType] void
# 2859| ValueCategory = prvalue
# 2859| getExpr(): [CStyleCast] (void)...
# 2859| Conversion = [VoidConversion] conversion to void
# 2859| Type = [VoidType] void
# 2859| ValueCategory = prvalue
# 2860| getStmt(7): [ReturnStmt] return ...
# 2846| [FunctionTemplateInstantiation,TopLevelFunction] void test_assert_in_template<short>(short, int, unsigned int)
# 2846| <params>:
# 2846| getParameter(0): [Parameter] x
# 2846| Type = [ShortType] short
# 2846| getParameter(1): [Parameter] y
# 2846| Type = [IntType] int
# 2846| getParameter(2): [Parameter] u
# 2846| Type = [IntType] unsigned int
# 2846| getEntryPoint(): [BlockStmt] { ... }
# 2847| getStmt(0): [ExprStmt] ExprStmt
# 2847| getExpr(): [Literal] 0
# 2847| Type = [IntType] int
# 2847| Value = [Literal] 0
# 2847| ValueCategory = prvalue
# 2847| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2847| Type = [VoidType] void
# 2847| ValueCategory = prvalue
# 2847| getExpr(): [CStyleCast] (void)...
# 2847| Conversion = [VoidConversion] conversion to void
# 2847| Type = [VoidType] void
# 2847| ValueCategory = prvalue
# 2848| getStmt(1): [ExprStmt] ExprStmt
# 2848| getExpr(): [Literal] 0
# 2848| Type = [IntType] int
# 2848| Value = [Literal] 0
# 2848| ValueCategory = prvalue
# 2848| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2848| Type = [VoidType] void
# 2848| ValueCategory = prvalue
# 2848| getExpr(): [CStyleCast] (void)...
# 2848| Conversion = [VoidConversion] conversion to void
# 2848| Type = [VoidType] void
# 2848| ValueCategory = prvalue
# 2849| getStmt(2): [ExprStmt] ExprStmt
# 2849| getExpr(): [Literal] 0
# 2849| Type = [IntType] int
# 2849| Value = [Literal] 0
# 2849| ValueCategory = prvalue
# 2849| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2849| Type = [VoidType] void
# 2849| ValueCategory = prvalue
# 2849| getExpr(): [CStyleCast] (void)...
# 2849| Conversion = [VoidConversion] conversion to void
# 2849| Type = [VoidType] void
# 2849| ValueCategory = prvalue
# 2851| getStmt(3): [EmptyStmt] ;
# 2853| getStmt(4): [ExprStmt] ExprStmt
# 2853| getExpr(): [Literal] 0
# 2853| Type = [IntType] int
# 2853| Value = [Literal] 0
# 2853| ValueCategory = prvalue
# 2853| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2853| Type = [VoidType] void
# 2853| ValueCategory = prvalue
# 2853| getExpr(): [CStyleCast] (void)...
# 2853| Conversion = [VoidConversion] conversion to void
# 2853| Type = [VoidType] void
# 2853| ValueCategory = prvalue
# 2855| getStmt(5): [BlockStmt] { ... }
# 2856| getStmt(0): [DeclStmt] declaration
# 2856| getDeclarationEntry(0): [VariableDeclarationEntry] definition of shadowed
# 2856| Type = [IntType] int
# 2856| getVariable().getInitializer(): [Initializer] initializer for shadowed
# 2856| getExpr(): [VariableAccess] x
# 2856| Type = [ShortType] short
# 2856| ValueCategory = prvalue(load)
# 2856| getExpr().getFullyConverted(): [CStyleCast] (int)...
# 2856| Conversion = [IntegralConversion] integral conversion
# 2856| Type = [IntType] int
# 2856| ValueCategory = prvalue
# 2857| getStmt(1): [ExprStmt] ExprStmt
# 2857| getExpr(): [Literal] 0
# 2857| Type = [IntType] int
# 2857| Value = [Literal] 0
# 2857| ValueCategory = prvalue
# 2857| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2857| Type = [VoidType] void
# 2857| ValueCategory = prvalue
# 2857| getExpr(): [CStyleCast] (void)...
# 2857| Conversion = [VoidConversion] conversion to void
# 2857| Type = [VoidType] void
# 2857| ValueCategory = prvalue
# 2859| getStmt(6): [ExprStmt] ExprStmt
# 2859| getExpr(): [Literal] 0
# 2859| Type = [IntType] int
# 2859| Value = [Literal] 0
# 2859| ValueCategory = prvalue
# 2859| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2859| Type = [VoidType] void
# 2859| ValueCategory = prvalue
# 2859| getExpr(): [CStyleCast] (void)...
# 2859| Conversion = [VoidConversion] conversion to void
# 2859| Type = [VoidType] void
# 2859| ValueCategory = prvalue
# 2860| getStmt(7): [ReturnStmt] return ...
# 2865| [TopLevelFunction] void complex_assertions(int, bool, int)
# 2865| <params>:
# 2865| getParameter(0): [Parameter] x
# 2865| Type = [IntType] int
# 2865| getParameter(1): [Parameter] b
# 2865| Type = [BoolType] bool
# 2865| getParameter(2): [Parameter] max
# 2865| Type = [IntType] int
# 2865| getEntryPoint(): [BlockStmt] { ... }
# 2866| getStmt(0): [DeclStmt] declaration
# 2866| getDeclarationEntry(0): [VariableDeclarationEntry] definition of y
# 2866| Type = [IntType] int
# 2866| getVariable().getInitializer(): [Initializer] initializer for y
# 2866| getExpr(): [CommaExpr] ... , ...
# 2866| Type = [IntType] int
# 2866| ValueCategory = prvalue(load)
# 2866| getLeftOperand(): [Literal] 0
# 2866| Type = [IntType] int
# 2866| Value = [Literal] 0
# 2866| ValueCategory = prvalue
# 2866| getRightOperand(): [VariableAccess] x
# 2866| Type = [IntType] int
# 2866| ValueCategory = prvalue(load)
# 2866| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2866| Type = [VoidType] void
# 2866| ValueCategory = prvalue
# 2866| getExpr(): [CStyleCast] (void)...
# 2866| Conversion = [VoidConversion] conversion to void
# 2866| Type = [VoidType] void
# 2866| ValueCategory = prvalue
# 2866| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2866| Type = [IntType] int
# 2866| ValueCategory = prvalue(load)
# 2867| getStmt(1): [DeclStmt] declaration
# 2867| getDeclarationEntry(0): [VariableDeclarationEntry] definition of z
# 2867| Type = [IntType] int
# 2867| getVariable().getInitializer(): [Initializer] initializer for z
# 2867| getExpr(): [ConditionalExpr] ... ? ... : ...
# 2867| Type = [IntType] int
# 2867| ValueCategory = prvalue
# 2867| getCondition(): [VariableAccess] b
# 2867| Type = [BoolType] bool
# 2867| ValueCategory = prvalue(load)
# 2867| getThen(): [CommaExpr] ... , ...
# 2867| Type = [IntType] int
# 2867| Value = [CommaExpr] 0
# 2867| ValueCategory = prvalue
# 2867| getLeftOperand(): [Literal] 0
# 2867| Type = [IntType] int
# 2867| Value = [Literal] 0
# 2867| ValueCategory = prvalue
# 2867| getRightOperand(): [Literal] 0
# 2867| Type = [IntType] int
# 2867| Value = [Literal] 0
# 2867| ValueCategory = prvalue
# 2867| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2867| Type = [VoidType] void
# 2867| ValueCategory = prvalue
# 2867| getExpr(): [CStyleCast] (void)...
# 2867| Conversion = [VoidConversion] conversion to void
# 2867| Type = [VoidType] void
# 2867| ValueCategory = prvalue
# 2867| getElse(): [Literal] 1
# 2867| Type = [IntType] int
# 2867| Value = [Literal] 1
# 2867| ValueCategory = prvalue
# 2867| getThen().getFullyConverted(): [ParenthesisExpr] (...)
# 2867| Type = [IntType] int
# 2867| Value = [ParenthesisExpr] 0
# 2867| ValueCategory = prvalue
# 2868| getStmt(2): [ReturnStmt] return ...
ir23.cpp:
# 1| [TopLevelFunction] bool consteval_1()
# 1| <params>:

View File

@@ -20741,6 +20741,157 @@ ir.cpp:
# 2821| v2821_10(void) = AliasedUse : m2821_3
# 2821| v2821_11(void) = ExitFunction :
# 2830| void test_assert_simple(int, int, unsigned int, int)
# 2830| Block 0
# 2830| v2830_1(void) = EnterFunction :
# 2830| m2830_2(unknown) = AliasedDefinition :
# 2830| m2830_3(unknown) = InitializeNonLocal :
# 2830| m2830_4(unknown) = Chi : total:m2830_2, partial:m2830_3
# 2830| r2830_5(glval<int>) = VariableAddress[x] :
# 2830| m2830_6(int) = InitializeParameter[x] : &:r2830_5
# 2830| r2830_7(glval<int>) = VariableAddress[y] :
# 2830| m2830_8(int) = InitializeParameter[y] : &:r2830_7
# 2830| r2830_9(glval<unsigned int>) = VariableAddress[u] :
# 2830| m2830_10(unsigned int) = InitializeParameter[u] : &:r2830_9
# 2830| r2830_11(glval<int>) = VariableAddress[shadowed] :
# 2830| m2830_12(int) = InitializeParameter[shadowed] : &:r2830_11
# 2831| r2831_1(int) = Constant[0] :
# 2831| v2831_2(void) = Convert : r2831_1
# 2832| r2832_1(int) = Constant[0] :
# 2832| v2832_2(void) = Convert : r2832_1
# 2833| r2833_1(int) = Constant[0] :
# 2833| v2833_2(void) = Convert : r2833_1
# 2835| v2835_1(void) = NoOp :
# 2837| r2837_1(int) = Constant[0] :
# 2837| v2837_2(void) = Convert : r2837_1
# 2840| r2840_1(glval<int>) = VariableAddress[shadowed] :
# 2840| r2840_2(glval<int>) = VariableAddress[x] :
# 2840| r2840_3(int) = Load[x] : &:r2840_2, m2830_6
# 2840| m2840_4(int) = Store[shadowed] : &:r2840_1, r2840_3
# 2841| r2841_1(int) = Constant[0] :
# 2841| v2841_2(void) = Convert : r2841_1
# 2843| v2843_1(void) = NoOp :
# 2830| v2830_13(void) = ReturnVoid :
# 2830| v2830_14(void) = AliasedUse : m2830_3
# 2830| v2830_15(void) = ExitFunction :
# 2846| void test_assert_in_template<int>(int, int, unsigned int)
# 2846| Block 0
# 2846| v2846_1(void) = EnterFunction :
# 2846| m2846_2(unknown) = AliasedDefinition :
# 2846| m2846_3(unknown) = InitializeNonLocal :
# 2846| m2846_4(unknown) = Chi : total:m2846_2, partial:m2846_3
# 2846| r2846_5(glval<int>) = VariableAddress[x] :
# 2846| m2846_6(int) = InitializeParameter[x] : &:r2846_5
# 2846| r2846_7(glval<int>) = VariableAddress[y] :
# 2846| m2846_8(int) = InitializeParameter[y] : &:r2846_7
# 2846| r2846_9(glval<unsigned int>) = VariableAddress[u] :
# 2846| m2846_10(unsigned int) = InitializeParameter[u] : &:r2846_9
# 2847| r2847_1(int) = Constant[0] :
# 2847| v2847_2(void) = Convert : r2847_1
# 2848| r2848_1(int) = Constant[0] :
# 2848| v2848_2(void) = Convert : r2848_1
# 2849| r2849_1(int) = Constant[0] :
# 2849| v2849_2(void) = Convert : r2849_1
# 2851| v2851_1(void) = NoOp :
# 2853| r2853_1(int) = Constant[0] :
# 2853| v2853_2(void) = Convert : r2853_1
# 2856| r2856_1(glval<int>) = VariableAddress[shadowed] :
# 2856| r2856_2(glval<int>) = VariableAddress[x] :
# 2856| r2856_3(int) = Load[x] : &:r2856_2, m2846_6
# 2856| m2856_4(int) = Store[shadowed] : &:r2856_1, r2856_3
# 2857| r2857_1(int) = Constant[0] :
# 2857| v2857_2(void) = Convert : r2857_1
# 2859| r2859_1(int) = Constant[0] :
# 2859| v2859_2(void) = Convert : r2859_1
# 2860| v2860_1(void) = NoOp :
# 2846| v2846_11(void) = ReturnVoid :
# 2846| v2846_12(void) = AliasedUse : m2846_3
# 2846| v2846_13(void) = ExitFunction :
# 2846| void test_assert_in_template<short>(short, int, unsigned int)
# 2846| Block 0
# 2846| v2846_1(void) = EnterFunction :
# 2846| m2846_2(unknown) = AliasedDefinition :
# 2846| m2846_3(unknown) = InitializeNonLocal :
# 2846| m2846_4(unknown) = Chi : total:m2846_2, partial:m2846_3
# 2846| r2846_5(glval<short>) = VariableAddress[x] :
# 2846| m2846_6(short) = InitializeParameter[x] : &:r2846_5
# 2846| r2846_7(glval<int>) = VariableAddress[y] :
# 2846| m2846_8(int) = InitializeParameter[y] : &:r2846_7
# 2846| r2846_9(glval<unsigned int>) = VariableAddress[u] :
# 2846| m2846_10(unsigned int) = InitializeParameter[u] : &:r2846_9
# 2847| r2847_1(int) = Constant[0] :
# 2847| v2847_2(void) = Convert : r2847_1
# 2848| r2848_1(int) = Constant[0] :
# 2848| v2848_2(void) = Convert : r2848_1
# 2849| r2849_1(int) = Constant[0] :
# 2849| v2849_2(void) = Convert : r2849_1
# 2851| v2851_1(void) = NoOp :
# 2853| r2853_1(int) = Constant[0] :
# 2853| v2853_2(void) = Convert : r2853_1
# 2856| r2856_1(glval<int>) = VariableAddress[shadowed] :
# 2856| r2856_2(glval<short>) = VariableAddress[x] :
# 2856| r2856_3(short) = Load[x] : &:r2856_2, m2846_6
# 2856| r2856_4(int) = Convert : r2856_3
# 2856| m2856_5(int) = Store[shadowed] : &:r2856_1, r2856_4
# 2857| r2857_1(int) = Constant[0] :
# 2857| v2857_2(void) = Convert : r2857_1
# 2859| r2859_1(int) = Constant[0] :
# 2859| v2859_2(void) = Convert : r2859_1
# 2860| v2860_1(void) = NoOp :
# 2846| v2846_11(void) = ReturnVoid :
# 2846| v2846_12(void) = AliasedUse : m2846_3
# 2846| v2846_13(void) = ExitFunction :
# 2865| void complex_assertions(int, bool, int)
# 2865| Block 0
# 2865| v2865_1(void) = EnterFunction :
# 2865| m2865_2(unknown) = AliasedDefinition :
# 2865| m2865_3(unknown) = InitializeNonLocal :
# 2865| m2865_4(unknown) = Chi : total:m2865_2, partial:m2865_3
# 2865| r2865_5(glval<int>) = VariableAddress[x] :
# 2865| m2865_6(int) = InitializeParameter[x] : &:r2865_5
# 2865| r2865_7(glval<bool>) = VariableAddress[b] :
# 2865| m2865_8(bool) = InitializeParameter[b] : &:r2865_7
# 2865| r2865_9(glval<int>) = VariableAddress[max] :
# 2865| m2865_10(int) = InitializeParameter[max] : &:r2865_9
# 2866| r2866_1(glval<int>) = VariableAddress[y] :
# 2866| r2866_2(int) = Constant[0] :
# 2866| v2866_3(void) = Convert : r2866_2
# 2866| r2866_4(glval<int>) = VariableAddress[x] :
# 2866| r2866_5(int) = Load[x] : &:r2866_4, m2865_6
# 2866| r2866_6(int) = CopyValue : r2866_5
# 2866| m2866_7(int) = Store[y] : &:r2866_1, r2866_6
# 2867| r2867_1(glval<int>) = VariableAddress[z] :
# 2867| r2867_2(glval<bool>) = VariableAddress[b] :
# 2867| r2867_3(bool) = Load[b] : &:r2867_2, m2865_8
# 2867| v2867_4(void) = ConditionalBranch : r2867_3
#-----| False -> Block 3
#-----| True -> Block 2
# 2867| Block 1
# 2867| m2867_5(int) = Phi : from 2:m2867_11, from 3:m2867_14
# 2867| r2867_6(glval<int>) = VariableAddress[#temp2867:13] :
# 2867| r2867_7(int) = Load[#temp2867:13] : &:r2867_6, m2867_5
# 2867| m2867_8(int) = Store[z] : &:r2867_1, r2867_7
# 2868| v2868_1(void) = NoOp :
# 2865| v2865_11(void) = ReturnVoid :
# 2865| v2865_12(void) = AliasedUse : m2865_3
# 2865| v2865_13(void) = ExitFunction :
# 2867| Block 2
# 2867| r2867_9(int) = Constant[0] :
# 2867| r2867_10(glval<int>) = VariableAddress[#temp2867:13] :
# 2867| m2867_11(int) = Store[#temp2867:13] : &:r2867_10, r2867_9
#-----| Goto -> Block 1
# 2867| Block 3
# 2867| r2867_12(int) = Constant[1] :
# 2867| r2867_13(glval<int>) = VariableAddress[#temp2867:13] :
# 2867| m2867_14(int) = Store[#temp2867:13] : &:r2867_13, r2867_12
#-----| Goto -> Block 1
ir23.cpp:
# 1| bool consteval_1()
# 1| Block 0

View File

@@ -2823,4 +2823,48 @@ void vla_sizeof_test5(int len1, size_t len2) {
size_t z = sizeof((*&tmp1)[1]);
}
// Common definitions for assertions in release builds
#define assert(x) ((void)0)
#define __analysis_assume(x)
void test_assert_simple(int x, int y, unsigned u, int shadowed) {
assert(x > 0);
assert(0 < x);
assert(x < y);
__analysis_assume(x != 2);
assert(u < x);
{
int shadowed = x;
assert(shadowed > 0);
}
}
template<typename T>
void test_assert_in_template(T x, int y, unsigned u) {
assert(x > 0);
assert(0 < x);
assert(x < y);
__analysis_assume(x != 2);
assert(u < x);
{
int shadowed = x;
assert(shadowed > 0);
}
assert(x> 0);
}
template void test_assert_in_template<int>(int, int, unsigned);
template void test_assert_in_template<short>(short, int, unsigned);
void complex_assertions(int x, bool b, int max) {
int y = (assert(x > 0), x);
int z = b ? (assert(x != 0), 0) : 1;
}
// semmle-extractor-options: -std=c++20 --clang

View File

@@ -18880,6 +18880,152 @@ ir.cpp:
# 2821| v2821_9(void) = AliasedUse : ~m?
# 2821| v2821_10(void) = ExitFunction :
# 2830| void test_assert_simple(int, int, unsigned int, int)
# 2830| Block 0
# 2830| v2830_1(void) = EnterFunction :
# 2830| mu2830_2(unknown) = AliasedDefinition :
# 2830| mu2830_3(unknown) = InitializeNonLocal :
# 2830| r2830_4(glval<int>) = VariableAddress[x] :
# 2830| mu2830_5(int) = InitializeParameter[x] : &:r2830_4
# 2830| r2830_6(glval<int>) = VariableAddress[y] :
# 2830| mu2830_7(int) = InitializeParameter[y] : &:r2830_6
# 2830| r2830_8(glval<unsigned int>) = VariableAddress[u] :
# 2830| mu2830_9(unsigned int) = InitializeParameter[u] : &:r2830_8
# 2830| r2830_10(glval<int>) = VariableAddress[shadowed] :
# 2830| mu2830_11(int) = InitializeParameter[shadowed] : &:r2830_10
# 2831| r2831_1(int) = Constant[0] :
# 2831| v2831_2(void) = Convert : r2831_1
# 2832| r2832_1(int) = Constant[0] :
# 2832| v2832_2(void) = Convert : r2832_1
# 2833| r2833_1(int) = Constant[0] :
# 2833| v2833_2(void) = Convert : r2833_1
# 2835| v2835_1(void) = NoOp :
# 2837| r2837_1(int) = Constant[0] :
# 2837| v2837_2(void) = Convert : r2837_1
# 2840| r2840_1(glval<int>) = VariableAddress[shadowed] :
# 2840| r2840_2(glval<int>) = VariableAddress[x] :
# 2840| r2840_3(int) = Load[x] : &:r2840_2, ~m?
# 2840| mu2840_4(int) = Store[shadowed] : &:r2840_1, r2840_3
# 2841| r2841_1(int) = Constant[0] :
# 2841| v2841_2(void) = Convert : r2841_1
# 2843| v2843_1(void) = NoOp :
# 2830| v2830_12(void) = ReturnVoid :
# 2830| v2830_13(void) = AliasedUse : ~m?
# 2830| v2830_14(void) = ExitFunction :
# 2846| void test_assert_in_template<int>(int, int, unsigned int)
# 2846| Block 0
# 2846| v2846_1(void) = EnterFunction :
# 2846| mu2846_2(unknown) = AliasedDefinition :
# 2846| mu2846_3(unknown) = InitializeNonLocal :
# 2846| r2846_4(glval<int>) = VariableAddress[x] :
# 2846| mu2846_5(int) = InitializeParameter[x] : &:r2846_4
# 2846| r2846_6(glval<int>) = VariableAddress[y] :
# 2846| mu2846_7(int) = InitializeParameter[y] : &:r2846_6
# 2846| r2846_8(glval<unsigned int>) = VariableAddress[u] :
# 2846| mu2846_9(unsigned int) = InitializeParameter[u] : &:r2846_8
# 2847| r2847_1(int) = Constant[0] :
# 2847| v2847_2(void) = Convert : r2847_1
# 2848| r2848_1(int) = Constant[0] :
# 2848| v2848_2(void) = Convert : r2848_1
# 2849| r2849_1(int) = Constant[0] :
# 2849| v2849_2(void) = Convert : r2849_1
# 2851| v2851_1(void) = NoOp :
# 2853| r2853_1(int) = Constant[0] :
# 2853| v2853_2(void) = Convert : r2853_1
# 2856| r2856_1(glval<int>) = VariableAddress[shadowed] :
# 2856| r2856_2(glval<int>) = VariableAddress[x] :
# 2856| r2856_3(int) = Load[x] : &:r2856_2, ~m?
# 2856| mu2856_4(int) = Store[shadowed] : &:r2856_1, r2856_3
# 2857| r2857_1(int) = Constant[0] :
# 2857| v2857_2(void) = Convert : r2857_1
# 2859| r2859_1(int) = Constant[0] :
# 2859| v2859_2(void) = Convert : r2859_1
# 2860| v2860_1(void) = NoOp :
# 2846| v2846_10(void) = ReturnVoid :
# 2846| v2846_11(void) = AliasedUse : ~m?
# 2846| v2846_12(void) = ExitFunction :
# 2846| void test_assert_in_template<short>(short, int, unsigned int)
# 2846| Block 0
# 2846| v2846_1(void) = EnterFunction :
# 2846| mu2846_2(unknown) = AliasedDefinition :
# 2846| mu2846_3(unknown) = InitializeNonLocal :
# 2846| r2846_4(glval<short>) = VariableAddress[x] :
# 2846| mu2846_5(short) = InitializeParameter[x] : &:r2846_4
# 2846| r2846_6(glval<int>) = VariableAddress[y] :
# 2846| mu2846_7(int) = InitializeParameter[y] : &:r2846_6
# 2846| r2846_8(glval<unsigned int>) = VariableAddress[u] :
# 2846| mu2846_9(unsigned int) = InitializeParameter[u] : &:r2846_8
# 2847| r2847_1(int) = Constant[0] :
# 2847| v2847_2(void) = Convert : r2847_1
# 2848| r2848_1(int) = Constant[0] :
# 2848| v2848_2(void) = Convert : r2848_1
# 2849| r2849_1(int) = Constant[0] :
# 2849| v2849_2(void) = Convert : r2849_1
# 2851| v2851_1(void) = NoOp :
# 2853| r2853_1(int) = Constant[0] :
# 2853| v2853_2(void) = Convert : r2853_1
# 2856| r2856_1(glval<int>) = VariableAddress[shadowed] :
# 2856| r2856_2(glval<short>) = VariableAddress[x] :
# 2856| r2856_3(short) = Load[x] : &:r2856_2, ~m?
# 2856| r2856_4(int) = Convert : r2856_3
# 2856| mu2856_5(int) = Store[shadowed] : &:r2856_1, r2856_4
# 2857| r2857_1(int) = Constant[0] :
# 2857| v2857_2(void) = Convert : r2857_1
# 2859| r2859_1(int) = Constant[0] :
# 2859| v2859_2(void) = Convert : r2859_1
# 2860| v2860_1(void) = NoOp :
# 2846| v2846_10(void) = ReturnVoid :
# 2846| v2846_11(void) = AliasedUse : ~m?
# 2846| v2846_12(void) = ExitFunction :
# 2865| void complex_assertions(int, bool, int)
# 2865| Block 0
# 2865| v2865_1(void) = EnterFunction :
# 2865| mu2865_2(unknown) = AliasedDefinition :
# 2865| mu2865_3(unknown) = InitializeNonLocal :
# 2865| r2865_4(glval<int>) = VariableAddress[x] :
# 2865| mu2865_5(int) = InitializeParameter[x] : &:r2865_4
# 2865| r2865_6(glval<bool>) = VariableAddress[b] :
# 2865| mu2865_7(bool) = InitializeParameter[b] : &:r2865_6
# 2865| r2865_8(glval<int>) = VariableAddress[max] :
# 2865| mu2865_9(int) = InitializeParameter[max] : &:r2865_8
# 2866| r2866_1(glval<int>) = VariableAddress[y] :
# 2866| r2866_2(int) = Constant[0] :
# 2866| v2866_3(void) = Convert : r2866_2
# 2866| r2866_4(glval<int>) = VariableAddress[x] :
# 2866| r2866_5(int) = Load[x] : &:r2866_4, ~m?
# 2866| r2866_6(int) = CopyValue : r2866_5
# 2866| mu2866_7(int) = Store[y] : &:r2866_1, r2866_6
# 2867| r2867_1(glval<int>) = VariableAddress[z] :
# 2867| r2867_2(glval<bool>) = VariableAddress[b] :
# 2867| r2867_3(bool) = Load[b] : &:r2867_2, ~m?
# 2867| v2867_4(void) = ConditionalBranch : r2867_3
#-----| False -> Block 3
#-----| True -> Block 2
# 2867| Block 1
# 2867| r2867_5(glval<int>) = VariableAddress[#temp2867:13] :
# 2867| r2867_6(int) = Load[#temp2867:13] : &:r2867_5, ~m?
# 2867| mu2867_7(int) = Store[z] : &:r2867_1, r2867_6
# 2868| v2868_1(void) = NoOp :
# 2865| v2865_10(void) = ReturnVoid :
# 2865| v2865_11(void) = AliasedUse : ~m?
# 2865| v2865_12(void) = ExitFunction :
# 2867| Block 2
# 2867| r2867_8(int) = Constant[0] :
# 2867| r2867_9(glval<int>) = VariableAddress[#temp2867:13] :
# 2867| mu2867_10(int) = Store[#temp2867:13] : &:r2867_9, r2867_8
#-----| Goto -> Block 1
# 2867| Block 3
# 2867| r2867_11(int) = Constant[1] :
# 2867| r2867_12(glval<int>) = VariableAddress[#temp2867:13] :
# 2867| mu2867_13(int) = Store[#temp2867:13] : &:r2867_12, r2867_11
#-----| Goto -> Block 1
ir23.cpp:
# 1| bool consteval_1()
# 1| Block 0