This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 02 Nov 2017 16:29:59 +0000
- Subject: [Bug ada/82813] warning: '.builtin_memcpy' writing between 2 and 6 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
- Auto-submitted: auto-generated
- References: <bug-82813-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82813
--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
It's unreachable code:
<bb 56> [0.23%] [count: INV]:
# DEBUG S117b.276 => &D.9593
.builtin_memcpy (&MEM[(void *)&D.9593], pretmp_305, _250);
The only predecessor is:
<bb 55> [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 <bb 54>; [64.00%]
else
goto <bb 56>; [36.00%]
whose only predecessor is:
<bb 23> [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 = &MEM[(void *)sw.246_6][1 ...]{lb: 1 sz: 1};
if (_37 >= _38)
goto <bb 24>; [50.00%]
else
goto <bb 55>; [50.00%]
So <bb 56> 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");
<bb 17> [7.26%] [count: INV]:
_19 = parent$P_BOUNDS_1->LB0;
_20 = parent$P_BOUNDS_1->UB0;
if (_19 > _20)
goto <bb 18>; [33.00%]
else
goto <bb 19>; [67.00%]
<bb 19> is a dominator of <bb 23> so <bb 23> 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 <bb 56> is not reachable.