Skip to content

Commit 024d668

Browse files
authored
Merge pull request #6496 from tautschnig/duplicate-label
C front-end: reject code containing duplicate labels
2 parents d42839d + 00f71da commit 024d668

File tree

11 files changed

+54
-20
lines changed

11 files changed

+54
-20
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
int main()
2+
{
3+
int x;
4+
label:
5+
x = 1;
6+
goto label;
7+
label:
8+
x = 2;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE test-c++-front-end
2+
main.c
3+
4+
^EXIT=(1|64)$
5+
^SIGNAL=0$
6+
error: duplicate label 'label'
7+
^CONVERSION ERROR$
8+
--
9+
^warning: ignoring

regression/cbmc-concurrency/atomic_section_sc3/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ unsigned dec() {
8585

8686
int main(){
8787
__CPROVER_ASYNC_1: inc();
88-
__CPROVER_ASYNC_1: dec();
89-
__CPROVER_ASYNC_1: dec();
88+
__CPROVER_ASYNC_2:
89+
dec();
90+
__CPROVER_ASYNC_3:
91+
dec();
9092

9193
return 0;
9294
}

regression/cbmc-concurrency/conditional_spawn2/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ int main()
1616
__CPROVER_ASYNC_1: thread();
1717
}
1818

19-
__CPROVER_ASYNC_1: thread();
20-
__CPROVER_ASYNC_1: thread();
19+
__CPROVER_ASYNC_2:
20+
thread();
21+
__CPROVER_ASYNC_3:
22+
thread();
2123

2224
__CPROVER_assert(n<4, "3 threads spawned");
2325

regression/cbmc-concurrency/generic_hw_sw_benchmark1/main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
#ifdef _ENABLE_CBMC_
1010

11-
#define ASYNC(c) __CPROVER_ASYNC_1: (c)
12-
#define ATOMIC_BEGIN __CPROVER_atomic_begin()
13-
#define ATOMIC_END __CPROVER_atomic_end()
11+
# define ASYNC(n, c) __CPROVER_ASYNC_##n : (c)
12+
# define ATOMIC_BEGIN __CPROVER_atomic_begin()
13+
# define ATOMIC_END __CPROVER_atomic_end()
1414

1515
char symbolic_char(char);
1616

@@ -233,7 +233,7 @@ void* write_data_register(struct Hardware *hw, RegisterId reg_id, Register value
233233
pthread_create(&interrupt_thread, NULL, hw->interrupt_handler, (void *) hw->fw);
234234
}
235235
#else
236-
ASYNC(hw->interrupt_handler((void *) hw->fw));
236+
ASYNC(1, hw->interrupt_handler((void *)hw->fw));
237237
#endif
238238

239239
SKIP:
@@ -346,7 +346,7 @@ int main(void)
346346
pthread_t firmware_thread;
347347
pthread_create(&firmware_thread, NULL, poll, (void *) fw);
348348
#else
349-
ASYNC(poll((void *) fw));
349+
ASYNC(1, poll((void *)fw));
350350
#endif
351351

352352
#ifdef _EXPOSE_BUG_
@@ -358,7 +358,7 @@ int main(void)
358358
pthread_t stimulus_thread;
359359
pthread_create(&stimulus_thread, NULL, stimulus, (void *) hw);
360360
#else
361-
ASYNC(stimulus((void *) hw));
361+
ASYNC(2, stimulus((void *)hw));
362362
#endif
363363

364364
#ifdef _EXPOSE_BUG_

regression/cbmc-concurrency/invalid_object1/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static signed int ethoc_reset(struct ethoc *dev)
283283
__CPROVER_ASYNC_1:
284284
open_eth_reg_write(dev->open_eth, (unsigned int)0, mode);
285285

286-
__CPROVER_ASYNC_1:
286+
__CPROVER_ASYNC_2:
287287
open_eth_reg_write(dev->open_eth, (unsigned int)0, mode);
288288
return 0;
289289
}

regression/cbmc-concurrency/recursion1/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main()
1313

1414
start2:
1515
(void)0;
16-
__CPROVER_ASYNC_1:
16+
__CPROVER_ASYNC_2:
1717
goto start2;
1818

1919
rec_spawn();

regression/cbmc-concurrency/svcomp13_qrcu_safe/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ void* qrcu_updater() {
118118

119119
int main() {
120120
__CPROVER_ASYNC_1: qrcu_reader1();
121-
__CPROVER_ASYNC_1: qrcu_reader2();
122-
__CPROVER_ASYNC_1: qrcu_updater();
121+
__CPROVER_ASYNC_2:
122+
qrcu_reader2();
123+
__CPROVER_ASYNC_3:
124+
qrcu_updater();
123125
return 0;
124126
}

regression/cbmc-concurrency/svcomp13_qrcu_unsafe/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ void* qrcu_updater() {
118118

119119
int main() {
120120
__CPROVER_ASYNC_1: qrcu_reader1();
121-
__CPROVER_ASYNC_1: qrcu_reader2();
122-
__CPROVER_ASYNC_1: qrcu_updater();
121+
__CPROVER_ASYNC_2:
122+
qrcu_reader2();
123+
__CPROVER_ASYNC_3:
124+
qrcu_updater();
123125
return 0;
124126
}

regression/cbmc-concurrency/svcomp13_read_write_lock_safe/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ void *reader() { //reader
3939

4040
int main() {
4141
__CPROVER_ASYNC_1: writer();
42-
__CPROVER_ASYNC_1: reader();
43-
__CPROVER_ASYNC_1: writer();
44-
__CPROVER_ASYNC_1: reader();
42+
__CPROVER_ASYNC_2:
43+
reader();
44+
__CPROVER_ASYNC_3:
45+
writer();
46+
__CPROVER_ASYNC_4:
47+
reader();
4548
return 0;
4649
}

0 commit comments

Comments
 (0)