public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "baldrick at free dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/19419] ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
Date: Fri, 14 Jan 2005 08:59:00 -0000	[thread overview]
Message-ID: <20050114085937.3543.qmail@sourceware.org> (raw)
In-Reply-To: <20050113075308.19419.baldrick@free.fr>


------- Additional Comments From baldrick at free dot fr  2005-01-14 08:59 -------
Subject: Re:  New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)

Here is a much simplified version:

> gnatmake -s -g -O2 tt
> valgrind --tool=memcheck ./tt
==10048== Memcheck, a memory error detector for x86-linux.
==10048== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al.
==10048== Using valgrind-2.3.0.CVS, a program supervision framework for x86-linux.
==10048== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al.
==10048== For more details, rerun with: -v
==10048==
==10048== Source and destination overlap in memcpy(0x52BFDE84, 0x52BFDE85, 2)
==10048==    at 0x1B906815: memcpy (mac_replace_strmem.c:113)
==10048==    by 0x80496F9: ss(short, long, int, double,...) (ss.adb:5)
==10048==    by 0x804978C: _ada_tt (tt.adb:9)
==10048==    by 0x8049634: main (b~tt.adb:112)
==10048==
==10048== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 11 from 1)
==10048== malloc/free: in use at exit: 10280 bytes in 2 blocks.
==10048== malloc/free: 2 allocs, 0 frees, 10280 bytes allocated.
==10048== For a detailed leak analysis,  rerun with: --leak-check=yes
==10048== For counts of detected errors, rerun with: -v

package SS is

   type Super_String (Length : Positive) is record
      Data : String (1 .. Length);
   end record;

   procedure Slide (Source : in out Super_String);

end SS;

package body SS is

   procedure Slide (Source : in out Super_String) is
   begin
      Source.Data (1 .. Source.Length - 1) := Source.Data (2 .. Source.Length);
   end;

end SS;

with SS; use SS;

procedure TT is
   S : Super_String := (
     Length => 3,
     Data   => "ABC"
   );
begin
   Slide (S);
end;



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19419


  reply	other threads:[~2005-01-14  8:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-13  7:53 [Bug ada/19419] New: " baldrick at free dot fr
2005-01-14  8:59 ` baldrick at free dot fr [this message]
2005-01-14 23:23 ` [Bug ada/19419] " baldrick at free dot fr
2005-01-14 23:35 ` [Bug middle-end/19419] " pinskia at gcc dot gnu dot org
2005-01-14 23:36 ` pinskia at gcc dot gnu dot org
2005-01-15 12:28 ` baldrick at free dot fr
2005-01-15 12:34 ` [Bug ada/19419] " steven at gcc dot gnu dot org
2005-01-15 16:27 ` [Bug middle-end/19419] " pinskia at gcc dot gnu dot org
2005-09-12  6:14 ` [Bug middle-end/19419] Overlapping memcpy with discriminated types ebotcazou at gcc dot gnu dot org
2005-09-12  7:27 ` ebotcazou at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050114085937.3543.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).