Opened 17 years ago

Last modified 11 years ago

#1011 new enhancement

valueFlowForLoop: switch inside a for loop

Reported by: aggro80 Owned by: noone
Priority: Normal Milestone:
Component: Improve check Version:
Keywords: valueflow Cc:

Description (last modified by Daniel Marjamäki)

Fix TODO test case array_index_switch_in_for()

void f() {
  int ar[10];
  for (int i = 0; i < 10; ++i) {
    switch(i) {
    case 8:
      ar[i] = 0;
      break;
    default:
      ar[i] = ar[i+1]; // i+1 => 10
      break;
    };
  }
}

Change History (2)

comment:1 by Danielmarjamaki, 12 years ago

Keywords: valueflow added
Priority: Normal
Summary: Array index out of bounds not detected if there is a switch inside a for loopvalueFlowForLoop: switch inside a for loop

comment:2 by Daniel Marjamäki, 11 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.