Skip to content

Commit 4f14adb

Browse files
authored
[SingleSource][Regressions][C] Fix loop-15.c so it does not trigger UB. (#189)
1 parent 90be4b7 commit 4f14adb

File tree

1 file changed

+5
-4
lines changed
  • SingleSource/Regression/C/gcc-c-torture/execute

1 file changed

+5
-4
lines changed

SingleSource/Regression/C/gcc-c-torture/execute/loop-15.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
void
44
foo (unsigned long *start, unsigned long *end)
55
{
6-
unsigned long *temp = end - 1;
7-
8-
while (end > start)
9-
*end-- = *temp--;
6+
while (end > start)
7+
{
8+
*end = *(end - 1);
9+
--end;
10+
}
1011
}
1112

1213
int

0 commit comments

Comments
 (0)