Skip to content

Commit eed4356

Browse files
committed
Avoid re-using output variables in new ecpg test case.
The buildfarm thinks this leads to memory stomps, though annoyingly I can't duplicate that here. The existing code in strings.pgc is doing something that doesn't seem to be sanctioned at all really by the documentation, but I'm disinclined to try to make that nicer right now. Let's just declare some more output variables in hopes of working around it.
1 parent 1e3868a commit eed4356

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

src/interfaces/ecpg/test/expected/preproc-strings.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424

2525

2626

27+
28+
2729

2830
#line 5 "strings.pgc"
2931

3032
#line 1 "strings.h"
31-
char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 ;
33+
char * s1 , * s2 , * s3 , * s4 , * s5 , * s6 , * s7 , * s8 ;
3234
/* exec sql end declare section */
3335
#line 5 "strings.pgc"
3436

@@ -64,14 +66,14 @@ int main(void)
6466
printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6);
6567

6668
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select b'0010' , x'019ABcd'", ECPGt_EOIT,
67-
ECPGt_char,&(s1),(long)0,(long)1,(1)*sizeof(char),
69+
ECPGt_char,&(s7),(long)0,(long)1,(1)*sizeof(char),
6870
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
69-
ECPGt_char,&(s2),(long)0,(long)1,(1)*sizeof(char),
71+
ECPGt_char,&(s8),(long)0,(long)1,(1)*sizeof(char),
7072
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
7173
#line 26 "strings.pgc"
7274

7375

74-
printf("%s %s\n", s1, s2);
76+
printf("%s %s\n", s7, s8);
7577

7678
{ ECPGdisconnect(__LINE__, "CURRENT");}
7779
#line 30 "strings.pgc"

src/interfaces/ecpg/test/expected/preproc-strings.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@
4444
[NO_PID]: sqlca: code: 0, state: 00000
4545
[NO_PID]: ecpg_process_output on line 25: correctly got 1 tuples with 2 fields
4646
[NO_PID]: sqlca: code: 0, state: 00000
47+
[NO_PID]: ecpg_store_result on line 25: allocating memory for 1 tuples
48+
[NO_PID]: sqlca: code: 0, state: 00000
4749
[NO_PID]: ecpg_get_data on line 25: RESULT: 0010 offset: -1; array: no
4850
[NO_PID]: sqlca: code: 0, state: 00000
51+
[NO_PID]: ecpg_store_result on line 25: allocating memory for 1 tuples
52+
[NO_PID]: sqlca: code: 0, state: 00000
4953
[NO_PID]: ecpg_get_data on line 25: RESULT: 0000000110011010101111001101 offset: -1; array: no
5054
[NO_PID]: sqlca: code: 0, state: 00000
5155
[NO_PID]: ecpg_finish: connection ecpg1_regression closed

src/interfaces/ecpg/test/preproc/strings.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ char *s1,
33
*s3,
44
*s4,
55
*s5,
6-
*s6;
6+
*s6,
7+
*s7,
8+
*s8;

src/interfaces/ecpg/test/preproc/strings.pgc

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ int main(void)
2323
printf("%s %s %s %s %s %s\n", s1, s2, s3, s4, s5, s6);
2424

2525
exec sql select b'0010', X'019ABcd'
26-
into :s1, :s2;
26+
into :s7, :s8;
2727

28-
printf("%s %s\n", s1, s2);
28+
printf("%s %s\n", s7, s8);
2929

3030
exec sql disconnect;
3131
return 0;

0 commit comments

Comments
 (0)