This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
valgrind shows ada/i-cobol.adb real bug
Hi, PR ada/19414
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19414
shows:
==3253== Invalid read of size 1
==3253== at 0x80523DB: interfaces__cobol__valid_numeric (i-cobol.adb:646)
==3253== Invalid read of size 1
==3253== at 0x8052439: interfaces__cobol__valid_numeric (i-cobol.adb:650)
==3253== Invalid read of size 1
==3253== at 0x8052471: interfaces__cobol__valid_numeric (i-cobol.adb:655)
The i-cobol code is:
<<
type Numeric is array (Positive range <>) of COBOL_Character;
function Valid_Numeric
(Item : Numeric;
Format : Display_Format)
return Boolean
is
begin
-- All character positions except first and last must be Digits.
-- This is true for all the formats.
for J in Item'First + 1 .. Item'Last - 1 loop
if Item (J) not in COBOL_Digits then
return False;
end if;
end loop;
case Format is
when Unsigned =>
return Item (Item'First) in COBOL_Digits
and then Item (Item'Last) in COBOL_Digits;
>>
When Item'length is zero, we still read Item (Item'First)
which is not a valid access as pointed out by Valgrind
(we don't raise a Constraint_Error since the RTS
is compiled with all checks off).
Robert, I don't know what this function is expected
to return in such a case and if there are similar
cases in the package, could you look at that?
Thanks in advance,
Laurent
On Thu, 2005-01-13 at 17:41 +0100, Duncan Sands wrote:
> Hi Geert,
>
> > > I plan to enter all these reports into bugzilla, then start analysing
> > > them to
> > > see which ones are bogus (it is good to have bogus reports and a note
> > > saying
> > > they are bogus in bugzilla, since it will save time if someone else
> > > sees the
> > > same valgrind failures).
> >
> > It doesn't make sense to open reports for every test that valgrind
> > flags.
> > For example, all the tasking tests most likely run into the same
> > valgrind
> > manipulation. Please don't open tons of reports for this, it only causes
> > much extra work in maintaining the bug database.
> >
> > Maybe it makes more sense to open one bug for all valgrind failures
> > and then open separate reports for each category of bug that you find to
> > be valid in at least some case, listing all tests affected by the bug.
>
> I opened the following bug reports yesterday:
>
> Conditional jump or move depends on uninitialised value: 19404 (c460010), 19412 (c761007), 19413 (c761010).
> Overlapping memcpy: 19410 (c64106a, C95087A) (middle-end bug), 19419 (CXA4009, CXA4020) (front-end bug?)
> Invalid read: 19414 (cxb4003), 19415 (c953001)
> Uninitialized data passed to syscall: 19416 (cxa9001, cxa9002)
>
> In other words, I opened bug reports for a small sample of the "Conditional jump or move depends on uninitialised"
> failures (since most of them seem to be the same); for the other kinds of errors I opened a bug report for each
> example or group of similar looking examples.
>
> All the best,
>
> Duncan.
>