Compile time warning: override-init

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
nelfata
Posts: 74
Joined: Wed Apr 30, 2014 10:50 pm

Compile time warning: override-init

Post by nelfata » Thu Feb 19, 2015 7:44 pm

Hi,
I am having many warning compiling vm.c on a GCC compiler that comes with Ride7 IDE.
gcc version 4.8.4 20140725

I am not sure why this is happening, I noticed in vmentrytable.h that there is a pragma line, could it be that it is being ignored?
What's the impact of that warning?

Thanks.


micropython/py/vmentrytable.h:34:5: warning: initialized field overwritten [-Woverride-init]
[MP_BC_LOAD_CONST_FALSE] = &&entry_MP_BC_LOAD_CONST_FALSE,
^
micropython/py/vmentrytable.h:34:5: warning: (near initialization for 'entry_table[16]') [-Woverride-init]
micropython\micropython/py/vmentrytable.h:35:5: warning: initialized field overwritten [-Woverride-init]
[MP_BC_LOAD_CONST_NONE] = &&entry_MP_BC_LOAD_CONST_NONE,
^

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Post by Damien » Fri Feb 20, 2015 10:06 am

That's strange. Is there a warning for all lines of that file or just for those two? A temporary fix is to set the configuration variable MICROPY_OPT_COMPUTED_GOTOS to 0.

nelfata
Posts: 74
Joined: Wed Apr 30, 2014 10:50 pm

Re: Compile time warning: override-init

Post by nelfata » Sun Feb 22, 2015 3:25 am

Yes every line has a warning. I just showed only a few lines in this post.
I am sure I am selecting some different compiler option, but I don't know which.
I can disable the GOTOS option but just wanted to understand the side effects of this warning.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Post by Damien » Sun Feb 22, 2015 10:00 pm

This warning in this case is harmless: the fields in the array all have default value of zero and they are being over written with the pointers to labels.

Did you have the correct -std=c99 option? Try -std=gnu99

nelfata
Posts: 74
Joined: Wed Apr 30, 2014 10:50 pm

Re: Compile time warning: override-init

Post by nelfata » Mon Feb 23, 2015 12:54 am

I am using: -std=gnu99

Here are the GCC options I am using:
-fomit-frame-pointer;-falign-functions=16;-ffunction-sections;-fdata-sections;-fno-common;-flto;-mfloat-abi=hard;-mfpu=fpv4-sp-d16;-fsingle-precision-constant;-Wall;-Wextra;-Wstrict-prototypes;-DCORTEX_USE_FPU=TRUE;-DTHUMB_PRESENT;-mno-thumb-interwork;-DTHUMB_NO_INTERWORKING;-DTHUMB;-std=gnu99 ;-Wdouble-promotion;-nostdlib;-mno-unaligned-access

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Post by Damien » Tue Feb 24, 2015 10:37 am

Do you have the latest version of all uPy files? Some bytecodes did change recently.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Compile time warning: override-init

Post by Damien » Tue Feb 24, 2015 11:26 pm

These warnings are fine and you can safely ignore them. But I still don't understand why your gcc compiler gives them in the first place...

nelfata
Posts: 74
Joined: Wed Apr 30, 2014 10:50 pm

Re: Compile time warning: override-init

Post by nelfata » Fri Feb 27, 2015 5:11 pm

The version I have is about 1 week old, and it compiles fine under Linux.
I will try to dig more and see.

Post Reply