jed-users mailing list

[2022 Date Index] [2022 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [jed-users] Weird warning & results in JED compilation


Nicholas Christopoulos <nereus@xxxxxxxxxxx> wrote:
> This weird warning shown when compiling (original) JED with default
> options (-g -O2)
>
> ```
> In function 'get_full_popup_name',
>     inlined from 'run_popup_callback' at
> /lanfs/src/jed/src/menu.c:1529:24: /lanfs/src/jed/src/menu.c:1518:2:
> warning: 'strncpy' specified bound depends on the length of the source
> argument [-Wstringop-overflow=] 1518 |  strncpy (s, parent->name, len);
>|  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /lanfs/src/jed/src/menu.c: In
> function 'run_popup_callback': /lanfs/src/jed/src/menu.c:1516:8: note:
> length computed here 1516 |  len = strlen (parent->name);
>       |        ^~~~~~~~~~~~~~~~~~~~~
> ```

The size of the space allocated to 's' was precomputed (see line 1499)
to avoid any overflow.  This warning can be ignored.

> I had some unexplained results in my patched code that added to
> original source. I lost one day huntings ghosts until I found something
> wrong was with default GCC optization.

In my experience what looks like a gcc optimization error usually
turns out to be user-error.  I suspect that this is the case here too.
Feel free to email me off-line and I will work with you on tracking
this down.

Thanks,
--John

>
> Example:
> ```
> void f(int x) {
> syslog(0, "JED FLAG: %08X\n", x); // outputs 2!
>}
> ...
> x = 6;
> f(x);
> ```
>
> Both issues solved by adding in first lines of menu.c
> #pragma GCC optimize("-O0")
> which means do not optimize this module.
>
> I would try to expain nothing... I had to report it and I did it.
> -- 
> Nicholas Christopoulos <mailto:nereus@xxxxxxxxxxx>
> Personal Pages: <https://nicholas-christopoulos.dev>
> Github repositories: <https://github.com/nereusx>
> _______________________________________________
> For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
>
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


[2022 date index] [2022 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]