From 4f14adb8a2f2c5fa02c6b3643d45e74adfcb31f9 Mon Sep 17 00:00:00 2001 From: ManuelJBrito <59119670+ManuelJBrito@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:41:29 +0000 Subject: [PATCH] [SingleSource][Regressions][C] Fix loop-15.c so it does not trigger UB. (#189) --- .../Regression/C/gcc-c-torture/execute/loop-15.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/loop-15.c b/SingleSource/Regression/C/gcc-c-torture/execute/loop-15.c index 8cb5125a2..45d02c9bd 100644 --- a/SingleSource/Regression/C/gcc-c-torture/execute/loop-15.c +++ b/SingleSource/Regression/C/gcc-c-torture/execute/loop-15.c @@ -3,10 +3,11 @@ void foo (unsigned long *start, unsigned long *end) { - unsigned long *temp = end - 1; - - while (end > start) - *end-- = *temp--; + while (end > start) + { + *end = *(end - 1); + --end; + } } int