mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02: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:
parent
dc77c1f3bb
commit
0d60cb3fdc
2 changed files with 8 additions and 1 deletions
|
@ -252,6 +252,7 @@ int testUpdateIssue() {
|
||||||
/* testUpdateIssue_init */
|
/* testUpdateIssue_init */
|
||||||
a = 1.22;
|
a = 1.22;
|
||||||
a = 1.22; // this redundant line is here to ensure 3 steps after running to this func leaves locals visible
|
a = 1.22; // this redundant line is here to ensure 3 steps after running to this func leaves locals visible
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int testUpdateIssue2() {
|
int testUpdateIssue2() {
|
||||||
|
@ -262,7 +263,8 @@ int testUpdateIssue2() {
|
||||||
z.d = 1.0;
|
z.d = 1.0;
|
||||||
/* testUpdateIssue2_init */
|
/* testUpdateIssue2_init */
|
||||||
z.d = 1.22;
|
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() {
|
int testConcurrentReadAndUpdateChild() {
|
||||||
|
@ -273,6 +275,7 @@ int testConcurrentReadAndUpdateChild() {
|
||||||
z.d = 1;
|
z.d = 1;
|
||||||
/* testConcurrentReadAndUpdateChild_init */
|
/* testConcurrentReadAndUpdateChild_init */
|
||||||
z.d = 2;
|
z.d = 2;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int testConcurrentUpdateOutOfScopeChildThenParent1() {
|
int testConcurrentUpdateOutOfScopeChildThenParent1() {
|
||||||
|
@ -283,6 +286,7 @@ int testConcurrentUpdateOutOfScopeChildThenParent1() {
|
||||||
z.d = 1;
|
z.d = 1;
|
||||||
/* testConcurrentUpdateOutOfScopeChildThenParent1_init */
|
/* testConcurrentUpdateOutOfScopeChildThenParent1_init */
|
||||||
z.d = 1; // this redundant line is here to ensure 2 steps after running to this func leaves locals visible
|
z.d = 1; // this redundant line is here to ensure 2 steps after running to this func leaves locals visible
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int testConcurrentUpdateOutOfScopeChildThenParent2() {
|
int testConcurrentUpdateOutOfScopeChildThenParent2() {
|
||||||
|
@ -293,11 +297,13 @@ int testConcurrentUpdateOutOfScopeChildThenParent2() {
|
||||||
z.d = 2;
|
z.d = 2;
|
||||||
/* testConcurrentUpdateOutOfScopeChildThenParent2_init */
|
/* testConcurrentUpdateOutOfScopeChildThenParent2_init */
|
||||||
z.d = 2; // this redundant line is here to ensure 2 steps after running to this func leaves locals visible
|
z.d = 2; // this redundant line is here to ensure 2 steps after running to this func leaves locals visible
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int testConcurrentUpdateOutOfScopeChildThenParent() {
|
int testConcurrentUpdateOutOfScopeChildThenParent() {
|
||||||
testConcurrentUpdateOutOfScopeChildThenParent1();
|
testConcurrentUpdateOutOfScopeChildThenParent1();
|
||||||
testConcurrentUpdateOutOfScopeChildThenParent2();
|
testConcurrentUpdateOutOfScopeChildThenParent2();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int testUpdateOfPointer() {
|
int testUpdateOfPointer() {
|
||||||
|
|
|
@ -63,6 +63,7 @@ int laterLineNotHitTest()
|
||||||
int laterLineDifferentFileTest()
|
int laterLineDifferentFileTest()
|
||||||
{ int b = 0;
|
{ int b = 0;
|
||||||
value(); // LATER_LINE_DIFFERENT_FILE_LINE
|
value(); // LATER_LINE_DIFFERENT_FILE_LINE
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int differentFileTest()
|
int differentFileTest()
|
||||||
|
|
Loading…
Add table
Reference in a new issue