dbTalk Databases Forums  

[BUGS] BUG #1774: ecpg preprocessor produces a wrong varchar struct

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1774: ecpg preprocessor produces a wrong varchar struct in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dirk Jagdmann
 
Posts: n/a

Default [BUGS] BUG #1774: ecpg preprocessor produces a wrong varchar struct - 07-18-2005 , 03:46 PM







The following bug has been logged online:

Bug reference: 1774
Logged by: Dirk Jagdmann
Email address: doj (AT) cubic (DOT) org
PostgreSQL version: 8.0.3
Operating system: i686 Linux 2.6
Description: ecpg preprocessor produces a wrong varchar struct
Details:

The ecpg preprocessor produces wrong code which does not compile.

--- input.pgc ---
int main()
{
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR v;
EXEC SQL END DECLARE SECTION;
return 0;
}
-------------------

Now process it with "ecpg input.pgc" which results in:
--- input.c ---
/* Processed by ecpg (4.0.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "input.pgc"
int main()
{
/* exec sql begin declare section */
#line 4 "input.pgc"
struct varchar_v { int len; char arr[ -1 ]; } v ;
/* exec sql end declare section */
#line 5 "input.pgc"
return 0;
}
---------------

The array size of the struct is -1 and this does not compile:
input.pgc: In function `main':
input.pgc:4: error: size of array `arr' is negative

I suppose the size should have been 0 so it can be malloced by the backend.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.