[Done] [BUG-v6b7CBE] 'volatile' creates undeclared (1st use in this function)?

All bugs related to new C backend
User avatar
skywalk
Addict
Addict
Posts: 3692
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

[Done] [BUG-v6b7CBE] 'volatile' creates undeclared (1st use in this function)?

Post by skywalk »

This is from a 65k line app that compiles OK with ASM and with earlier v6 betas CBE before adding 'volatile' defines.
The error occurs with and without debugger. Without debugger is easier to load purebasic.c file.

Any hints how to fix this type of error?

Code: Select all

---------------------------
PureBasic - Assembler error
---------------------------
error: 'rr4318' undeclared (first use in this function); did you mean 'rr4319'?
 SYS_ReAllocateArray((v_nf+1),&(*rr4318).f_f);
                                 ^~~~~~
                                 rr4319
purebasic.c:23700:33: note: each undeclared identifier is reported only once for each function it appears in
purebasic.c:23701:87: warning: passing argument 2 of 'PB_GetMapElement' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
 s_offsets* rr4321=(s_offsets*)PB_GetMapElement(m_mapcal.a,v_rfpdS);
...
                                         ~~~~~~~~^~~~~~
---------------------------
OK   
---------------------------
Last edited by skywalk on Thu May 05, 2022 9:57 pm, edited 1 time in total.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Fred
Administrator
Administrator
Posts: 14732
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [BUG-v6b6CBE] 'volatile' creates undeclared (1st use in this function)?

Post by Fred »

The volatile error is just a warning, I will disable it as it's not relevant for us. Could you give more info about the reallocate array ?
User avatar
skywalk
Addict
Addict
Posts: 3692
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: [BUG-v6b6CBE] 'volatile' creates undeclared (1st use in this function)?

Post by skywalk »

Ok, found a workaround.

Code: Select all

Structure Offsets
  ..Large structure..
  Array F.d(0)
  ..More arrays..
EndStructure
Global NewMap Cal.Offsets(16)

Procedure Init(nF.i)
  Protected.i nF2 = nF  ;<-- THIS CREATES ERROR.
  ClearMap(Cal())
  If nF > 0
;    nF2 = nF           ;<-- THIS FIXES ERROR.
    nF - 1
    ReDim Cal(mykey$)\F(nF) ;<-- THIS IS THE ARRAY.
..
..
EndProcedure
Now I am getting additional errors I have to debug.
Catching purebasic.c BEFORE it is deleted is not fun. :evil:

EDIT: I also get different errors if I exit & restart IDE after a compiler error?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
skywalk
Addict
Addict
Posts: 3692
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: [BUG-v6b6CBE] 'volatile' creates undeclared (1st use in this function)?

Post by skywalk »

If I don't restart the IDE, then the original error reappears?

The 2nd error maybe something similar, where I have a conditional statement before redim's, etc.

If I copy the purebasic.c before it is fully formed, I get erroneous sections and the referred line numbers make no sense pointing to many strings of NUL-NUL-NUL-...

EDIT: There are actually 2 errors listed within the dialog box?
error: invalid storage class for function 'f_aio_libopen_usb_aio16'
purebasic.c:9052:1: warning: null character(s) ignored

Can you dump the assembler error to a log file for easier access?
And stop deleting purebasic.c during the beta phase?

I cannot compile and debug effectively with v6b6?
Going back to ASM for now.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User_Russian
Addict
Addict
Posts: 1327
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: [BUG-v6b6CBE] 'volatile' creates undeclared (1st use in this function)?

Post by User_Russian »

I confirm this error.

Code: Select all

error: 'rr1' undeclared (first use in this function); did you mean 'rr2'?

 SYS_ReAllocateArray((v_nf+1),&(*rr1).f_f);

                                 ^~~

                                 rr2

purebasic.c:91:33: note: each undeclared identifier is reported only once for each function it appears in

purebasic.c:95:16: warning: passing argument 1 of 'SYS_FreeString' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]

 SYS_FreeString(v_mykeyS);
C code.

Code: Select all

#pragma warning(disable: 4024)
typedef long long quad;
typedef int integer;
#define PB_INFINITY (1.0 / 0.0)
#define PB_NEG_INFINITY (-1.0 / 0.0)
typedef struct pb_array { void *a; } pb_array;
typedef struct pb_array2 { void *a; integer b[2]; } pb_array2;
typedef struct pb_array3 { void *a; integer b[3]; } pb_array3;
typedef struct pb_array4 { void *a; integer b[4]; } pb_array4;
typedef struct pb_array5 { void *a; integer b[5]; } pb_array5;
typedef struct pb_array6 { void *a; integer b[6]; } pb_array6;
typedef struct pb_array7 { void *a; integer b[7]; } pb_array7;
typedef struct pb_array8 { void *a; integer b[8]; } pb_array8;
typedef struct pb_array9 { void *a; integer b[9]; } pb_array9;
typedef struct pb_listitem { void *a; void *b; void *c;} pb_listitem;
typedef struct pb_list { void *a; pb_listitem *b; } pb_list;
typedef struct pb_mapitem { void *a; void *b; void *c;} pb_mapitem;
typedef struct pb_pbmap { pb_mapitem *a; } pb_pbmap;
typedef struct pb_map { pb_pbmap *a; } pb_map;
static integer s_s[]={0, -1};
#define M_SYSFUNCTION(a) a __stdcall
#define M_PBFUNCTION(a) a __stdcall
typedef struct pb_variant { int a; int b; int c; int d; } pb_variant;
#define M_CDECL
typedef void TCHAR;
static integer SYS_BankerRound    (double i) { return i >= 0 ? i+0.5 : i-0.5; }
static quad    SYS_BankerRoundQuad(double i) { return i >= 0 ? i+0.5 : i-0.5; }
integer __stdcall f_exitprocess_(integer) asm("_ExitProcess@4");
integer __stdcall f_heapcreate_(integer,integer,integer) asm("_HeapCreate@12");
integer __stdcall f_heapdestroy_(integer) asm("_HeapDestroy@4");
integer __stdcall f_getmodulehandle_(integer) asm("_GetModuleHandleW@4");
integer __stdcall PB_ClearMap(void*);
integer __stdcall PB_FreeMap(void*);
integer __stdcall PB_FreeObjects();
integer __stdcall PB_InitArray();
integer __stdcall PB_InitMap();
static char *tls;
int PB_ExitCode=0;
integer PB_MemoryBase=0;
integer PB_Instance=0;
unsigned char *pb_datapointer;
void SYS_Quit();
M_SYSFUNCTION(void) SYS_InitPureBasic();
M_SYSFUNCTION(void) SYS_InitDynamicStructure(void *Address, integer *StructureMap);
M_SYSFUNCTION(void) SYS_FreeString(TCHAR *String);
M_SYSFUNCTION(void *) SYS_AllocateArray(integer ElementSize, integer NbElements, int Type, integer *StructureMap, pb_array *Address);
M_SYSFUNCTION(void) SYS_ReAllocateArray(integer NbElements, pb_array *Address);
M_SYSFUNCTION(void) SYS_FreeArray(pb_array *Array);
M_PBFUNCTION(void *) PB_NewMap(integer ElementSize, int ElementType, integer *StructureMap, void *Address, int HashSize);
M_PBFUNCTION(void *) PB_GetMapElement(void *Map, void *Key);
extern void *PB_StringBase;
extern integer PB_StringBasePosition;
M_SYSFUNCTION(void) SYS_InitString(void);
M_SYSFUNCTION(void) SYS_FreeStrings(void);
M_SYSFUNCTION(void) SYS_PushStringBasePosition(void);
M_SYSFUNCTION(integer) SYS_PopStringBasePosition(void);
M_SYSFUNCTION(integer) SYS_PopStringBasePositionUpdate(void);
M_SYSFUNCTION(void *) SYS_PopStringBasePositionValue(void);
M_SYSFUNCTION(void *) SYS_PopStringBasePositionValueNoUpdate(void);
M_SYSFUNCTION(integer) SYS_GetStringBasePosition(void);
M_SYSFUNCTION(void) SYS_SetStringBasePosition(integer Position);
M_SYSFUNCTION(integer) SYS_StringBasePositionNoPop(void);
M_SYSFUNCTION(char *) SYS_GetStringBase(void);
int PB_DEBUGGER_LineNumber=-1;
int PB_DEBUGGER_IncludedFiles=0;
char *PB_DEBUGGER_FileName=0;
typedef struct s_offsets s_offsets;
static __stdcall integer f_init(integer v_nf);
#pragma pack(1)
typedef struct s_offsets {
pb_array f_f;
} s_offsets;
#pragma pack()

static integer ms_s[]={0,-1};
static integer ms_offsets[];
static integer ms_offsets[]={
-4,0,8,1,12,0,
-1};
static pb_map m_cal={0};
static __stdcall integer f_init(integer v_nf) {
integer r=0;
volatile void* v_mykeyS=0;
volatile integer v_nf2=0;
v_nf2=v_nf;
void* p0=(void*)(m_cal.a);
integer rr0=PB_ClearMap(p0);
if (!((v_nf>0))) { goto no2; }
v_nf=(v_nf+-1);
s_offsets* rr2=(s_offsets*)PB_GetMapElement(m_cal.a,v_mykeyS);
SYS_ReAllocateArray((v_nf+1),&(*rr1).f_f);
no2:;
r=0;
end:
SYS_FreeString(v_mykeyS);
return r;
}
int PB_Compiler_Unicode=1;
int PB_Compiler_Thread=0;
int PB_Compiler_Purifier=0;
int PB_Compiler_Debugger=0;
int PB_Compiler_DPIAware=0;
int PB_Compiler_XPSkins=1;
int PB_ExecutableType=0;
void PB_EndFunctions() {
PB_FreeObjects();
}
int __stdcall WinMain(void *instance, void *prevInstance, void *cmdLine, int cmdShow) {
PB_Instance = f_getmodulehandle_(0);
PB_MemoryBase = f_heapcreate_(0,4096,0);
SYS_InitString();
PB_InitArray();
PB_InitMap();
//
PB_NewMap(4,7,ms_offsets,&m_cal,16);;
integer rr3=f_init(2);
SYS_Quit();
}

void SYS_Quit() {
PB_EndFunctions();
f_heapdestroy_(PB_MemoryBase);
f_exitprocess_(PB_ExitCode);
}
User avatar
skywalk
Addict
Addict
Posts: 3692
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: [BUG-v6b7CBE] 'volatile' creates undeclared (1st use in this function)?

Post by skywalk »

Downloaded v6b7 and same error. :?:
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Fred
Administrator
Administrator
Posts: 14732
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [BUG-v6b7CBE] 'volatile' creates undeclared (1st use in this function)?

Post by Fred »

Yes, not fixed yet.
Fred
Administrator
Administrator
Posts: 14732
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [Done] [BUG-v6b7CBE] 'volatile' creates undeclared (1st use in this function)?

Post by Fred »

Fixed.
User avatar
skywalk
Addict
Addict
Posts: 3692
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: [Done] [BUG-v6b7CBE] 'volatile' creates undeclared (1st use in this function)?

Post by skywalk »

Great! v6b8 now compiles my app. ~65k lines.
With optimizer on, compile time is much longer than v6b1-6.
There are still intermittent errors with IDE that come and go.
I turned off the optimizer and got an ASSEMBLER/C error.
Then tried again and code compiled fine.
With and without optimizer is marginal time so I just leave the optimizer on.

I will continue to monitor the betas but drop back to ASM compiles for now.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply