- Subject: [jed-users] Weird warning & results in JED compilation
- From: Nicholas Christopoulos <nereus@xxxxxxxxxxx>
- Date: Mon, 19 Sep 2022 12:47:14 +0300
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);
| ^~~~~~~~~~~~~~~~~~~~~
```
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.
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>.
[2022 date index]
[2022 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]