[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813 Bug 82813 depends on bug 80545, which changed state. Bug 80545 Summary: option -Wstringop-overflow not recognized by Fortran https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545 What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED
[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813 Eric Botcazou changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |7.4 --- Comment #7 from Eric Botcazou --- Sort of.
[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813 --- Comment #6 from Eric Botcazou --- Author: ebotcazou Date: Mon Mar 12 22:40:19 2018 New Revision: 258467 URL: https://gcc.gnu.org/viewcvs?rev=258467=gcc=rev Log: PR ada/82813 * gcc-interface/misc.c (gnat_post_options): Disable string overflow warnings. Modified: branches/gcc-7-branch/gcc/ada/ChangeLog branches/gcc-7-branch/gcc/ada/gcc-interface/misc.c
[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813 --- Comment #5 from Eric Botcazou --- Author: ebotcazou Date: Mon Mar 12 22:40:05 2018 New Revision: 258466 URL: https://gcc.gnu.org/viewcvs?rev=258466=gcc=rev Log: PR ada/82813 * gcc-interface/misc.c (gnat_post_options): Disable string overflow warnings. Modified: trunk/gcc/ada/ChangeLog trunk/gcc/ada/gcc-interface/misc.c
[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813 --- Comment #4 from Eric Botcazou --- > The warning will go away once pr80545 is fixed but I wonder if a better > (independent) solution in this case is to detect that the code is, in fact, > unreachable, and avoid emitting it to begin with. Yes, it's a missed optimization at the GIMPLE level. > Alternatively, if it is too hard to determine that it's unreachable, it should > be possible to detect that the memcpy call is invalid earlier and replace it > with either __builtin_unreachable or __builtin_trap. Possibly, 121t.phicprop1 has: S117b.276_245 = .builtin_alloca_with_align (0, 8); # DEBUG S117b.276 => S117b.276_245 _46 = (sizetype) j_231; _48 = &*sw.246_6[1 ...]{lb: 1 sz: 1}; _49 = &*S117b.276_245[1 ...]{lb: 1 sz: 1}; .builtin_memcpy (_49, _48, _46);
[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813 Martin Sebor changed: What|Removed |Added Depends on||80545 --- Comment #3 from Martin Sebor --- The warning will go away once pr80545 is fixed but I wonder if a better (independent) solution in this case is to detect that the code is, in fact, unreachable, and avoid emitting it to begin with. Alternatively, if it is too hard to determine that it's unreachable, it should be possible to detect that the memcpy call is invalid earlier and replace it with either __builtin_unreachable or __builtin_trap. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80545 [Bug 80545] option -Wstringop-overflow not recognized by Fortran
[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813 --- Comment #2 from Eric Botcazou --- It's unreachable code: [0.23%] [count: INV]: # DEBUG S117b.276 => .builtin_memcpy ([(void *)], pretmp_305, _250); The only predecessor is: [0.32%] [count: INV]: L113b_224 = start_130 + _322; # DEBUG L114b => 1 # DEBUG make_util__ensure_absolute_path__B_4__L_5__TTS117bSP1___L => 1 # DEBUG make_util__ensure_absolute_path__B_4__L_5__TTS117bSP1___U => L113b_224 # DEBUG D.7306 => 1 # DEBUG iftmp.271 => 1 + 18446744073709551615 if (L113b_224 != 0) goto ; [64.00%] else goto ; [36.00%] whose only predecessor is: [0.63%] [count: INV]: _37 = parent$P_BOUNDS_1->UB0; _38 = parent$P_BOUNDS_1->LB0; _330 = iftmp.245_24 - start_130; _322 = _330 + 1; _250 = (sizetype) j_231; pretmp_305 = [(void *)sw.246_6][1 ...]{lb: 1 sz: 1}; if (_37 >= _38) goto ; [50.00%] else goto ; [50.00%] So is reachable only if parent$P_BOUNDS_1->UB0 < parent$P_BOUNDS_1->LB0 is true. But this condition is caught by the block just above: if Parent'Length = 0 then Do_Fail ("relative search path switches (""" & Sw & """) are not allowed"); [7.26%] [count: INV]: _19 = parent$P_BOUNDS_1->LB0; _20 = parent$P_BOUNDS_1->UB0; if (_19 > _20) goto ; [33.00%] else goto ; [67.00%] is a dominator of so is reachable only if parent$P_BOUNDS_1->LB0 > parent$P_BOUNDS_1->UB0 is false, which is the opposite of the above condition, so is not reachable.
[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813 Eric Botcazou changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2017-11-02 CC||ebotcazou at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Eric Botcazou --- I can reproduce.