Skip to content

Regression in goto-cc since PR #2490 switch-range was merged #2583

Closed
@chrisr-diffblue

Description

@chrisr-diffblue

The following example:

#define C1 (int) ( 0. / 1. + 0.5)
#define C2 (int) ( 1. / 1. + 0.5)

extern int g_c;
int g_out;

void main(void)
{
  switch (g_c)
  {
  case C1:
      g_out = 1;
      break;
  case C2:
      g_out = 2;
      break;
  default:
       break;
  }
}

Used to be able to be compiled by goto-cc, but since #2490 was merged this example now fails to compile due to a type check failure:

goto-cc test.c
test.c: In function 'main':
test.c:11:1: error: expected constant expression, but got `(signed int)(0.0 / 1.0 + 0.5)'
CONVERSION ERROR

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