1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Fix undefined behaviour in C code problem

Without the return, this code would core dump, depending
on compiler version. The compiler was generating a warning
too about the missing return.

Part of #816
This commit is contained in:
Jonah Graham 2024-12-28 12:33:56 -05:00
parent dc77c1f3bb
commit 0d60cb3fdc
2 changed files with 8 additions and 1 deletions

View file

@ -252,6 +252,7 @@ int testUpdateIssue() {
/* testUpdateIssue_init */
a = 1.22;
a = 1.22; // this redundant line is here to ensure 3 steps after running to this func leaves locals visible
return 0;
}
int testUpdateIssue2() {
@ -262,7 +263,8 @@ int testUpdateIssue2() {
z.d = 1.0;
/* testUpdateIssue2_init */
z.d = 1.22;
z.d = 1.22; // this redundant line is here to ensure 3 steps after running to this func leaves locals visible
z.d = 1.22; // this redundant line is here to ensure 3 steps after running to this func leaves locals visible
return 0;
}
int testConcurrentReadAndUpdateChild() {
@ -273,6 +275,7 @@ int testConcurrentReadAndUpdateChild() {
z.d = 1;
/* testConcurrentReadAndUpdateChild_init */
z.d = 2;
return 0;
}
int testConcurrentUpdateOutOfScopeChildThenParent1() {
@ -283,6 +286,7 @@ int testConcurrentUpdateOutOfScopeChildThenParent1() {
z.d = 1;
/* testConcurrentUpdateOutOfScopeChildThenParent1_init */
z.d = 1; // this redundant line is here to ensure 2 steps after running to this func leaves locals visible
return 0;
}
int testConcurrentUpdateOutOfScopeChildThenParent2() {
@ -293,11 +297,13 @@ int testConcurrentUpdateOutOfScopeChildThenParent2() {
z.d = 2;
/* testConcurrentUpdateOutOfScopeChildThenParent2_init */
z.d = 2; // this redundant line is here to ensure 2 steps after running to this func leaves locals visible
return 0;
}
int testConcurrentUpdateOutOfScopeChildThenParent() {
testConcurrentUpdateOutOfScopeChildThenParent1();
testConcurrentUpdateOutOfScopeChildThenParent2();
return 0;
}
int testUpdateOfPointer() {

View file

@ -63,6 +63,7 @@ int laterLineNotHitTest()
int laterLineDifferentFileTest()
{ int b = 0;
value(); // LATER_LINE_DIFFERENT_FILE_LINE
return 0;
}
int differentFileTest()