Skip to content

c_typecheck_expr does not work with compound literals #5256

Closed
@hannes-steffenhagen-diffblue

Description

This somehow gets avoided most of the time, but I don’t suppose there’s a good reason why it wouldn’t work?

I think this would “fix” it by basically doing nothing.

diff --git a/src/ansi-c/c_typecheck_expr.cpp b/src/ansi-c/c_typecheck_expr.cpp
index eb081c8c1..b4966aaac 100644
--- a/src/ansi-c/c_typecheck_expr.cpp
+++ b/src/ansi-c/c_typecheck_expr.cpp
@@ -171,6 +171,14 @@ void c_typecheck_baset::typecheck_expr_main(exprt &expr)
     typecheck_expr_side_effect(to_side_effect_expr(expr));
   else if(expr.id()==ID_constant)
     typecheck_expr_constant(expr);
+  else if(expr.id() == ID_compound_literal)
+  {
+    // do nothing
+  }
+  else if(expr.id() == ID_struct)
+  {
+    // do nothing
+  }
   else if(expr.id()==ID_infinity)
   {
     // ignore

CBMC version:
Operating system:
Exact command line resulting in the issue:
What behaviour did you expect:
What happened instead:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions