public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
@ 2005-01-13  7:53 baldrick at free dot fr
  2005-01-14  8:59 ` [Bug ada/19419] " baldrick at free dot fr
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: baldrick at free dot fr @ 2005-01-13  7:53 UTC (permalink / raw)
  To: gcc-bugs

Originally noted in [Bug middle-end/19410], but seems to be a different 
problem (maybe front-end). 
 
RUN cxa4020 
==24948== Memcheck, a memory error detector for x86-linux. 
==24948== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward et al. 
==24948== Using valgrind-2.3.0.CVS, a program supervision framework for 
x86-linux. 
==24948== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward et al. 
==24948== For more details, rerun with: -v 
==24948== 
 
,.,. CXA4020 ACATS 2.5 05-01-11 17:13:16 
---- CXA4020 Check that the subprograms defined in package 
                Ada.Strings.Wide_Bounded are available, and that they 
                produce correct results, especially under conditions 
                where truncation of the result is required. 
==24948== Source and destination overlap in memcpy(0x52BFC8F8, 0x52BFC8FC, 8) 
==24948==    at 0x1B906AC5: memcpy (mac_replace_strmem.c:113) 
==24948==    by 0x805CABC: ada__strings__wide_superbounded__super_trim__4 
(a-stwisu.adb:1664) 
==24948==    by 0x8068805: cxa4020__test_block__b10__trim__4.1007 
(a-stwibo.ads:810) 
==24948==    by 0x806ABF6: _ada_cxa4020 (cxa4020.adb:396) 
==24948== 
==24948== Source and destination overlap in memcpy(0x52BFC8F8, 0x52BFC8FC, 12) 
==24948==    at 0x1B906AC5: memcpy (mac_replace_strmem.c:113) 
==24948==    by 0x805CABC: ada__strings__wide_superbounded__super_trim__4 
(a-stwisu.adb:1664) 
==24948==    by 0x8068805: cxa4020__test_block__b10__trim__4.1007 
(a-stwibo.ads:810) 
==24948==    by 0x806ACDC: _ada_cxa4020 (cxa4020.adb:411) 
==24948== 
==24948== Source and destination overlap in memcpy(0x52BFC8F8, 0x52BFC8FC, 12) 
==24948==    at 0x1B906AC5: memcpy (mac_replace_strmem.c:113) 
==24948==    by 0x805CABC: ada__strings__wide_superbounded__super_trim__4 
(a-stwisu.adb:1664) 
==24948==    by 0x8068805: cxa4020__test_block__b10__trim__4.1007 
(a-stwibo.ads:810) 
==24948==    by 0x806ADC2: _ada_cxa4020 (cxa4020.adb:422) 
==24948== 
==24948== Source and destination overlap in memcpy(0x52BFC8F8, 0x52BFC900, 10) 
==24948==    at 0x1B906AC5: memcpy (mac_replace_strmem.c:113) 
==24948==    by 0x805CABC: ada__strings__wide_superbounded__super_trim__4 
(a-stwisu.adb:1664) 
==24948==    by 0x8068805: cxa4020__test_block__b10__trim__4.1007 
(a-stwibo.ads:810) 
==24948==    by 0x806AEA8: _ada_cxa4020 (cxa4020.adb:433) 
==== CXA4020 PASSED ============================. 
==24948== 
==24948== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 13 from 1) 
==24948== malloc/free: in use at exit: 10280 bytes in 2 blocks. 
==24948== malloc/free: 23 allocs, 21 frees, 12122 bytes allocated. 
==24948== For a detailed leak analysis,  rerun with: --leak-check=yes 
==24948== For counts of detected errors, rerun with: -v 
PASS:   cxa4020

-- 
           Summary: ACATS CXA4009, CXA4020 - valgrind detects bad code
                    (overlapping memcpy)
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: baldrick at free dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/19419] ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
@ 2005-01-14  8:59 ` baldrick at free dot fr
  2005-01-14 23:23 ` baldrick at free dot fr
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: baldrick at free dot fr @ 2005-01-14  8:59 UTC (permalink / raw)
  To: gcc-bugs


------- 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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/19419] ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
  2005-01-14  8:59 ` [Bug ada/19419] " baldrick at free dot fr
@ 2005-01-14 23:23 ` baldrick at free dot fr
  2005-01-14 23:35 ` [Bug middle-end/19419] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: baldrick at free dot fr @ 2005-01-14 23:23 UTC (permalink / raw)
  To: gcc-bugs


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

The problem seems to be in the front-end, since the memcpy is already present in the "generic" tree dump, ss.adb.t03.generic.


-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/19419] ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
  2005-01-14  8:59 ` [Bug ada/19419] " baldrick at free dot fr
  2005-01-14 23:23 ` baldrick at free dot fr
@ 2005-01-14 23:35 ` pinskia at gcc dot gnu dot org
  2005-01-14 23:36 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 23:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 23:35 -------
Confirmed, the problem is in gimplify_modify_expr_to_memcpy (but this is not a regression even 
though this is a middle-end problem).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|ada                         |middle-end
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.3 4.0.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-14 23:35:25
               date|                            |
            Version|tree-ssa                    |4.0.0


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/19419] ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
                   ` (2 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 23:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 23:36 -------
Note this is a different problem from PR 19410, even though they are both middle-end problems.

-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/19419] ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: baldrick at free dot fr @ 2005-01-15 12:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From baldrick at free dot fr  2005-01-15 12:27 -------
Subject: Re:  ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)

> Confirmed, the problem is in gimplify_modify_expr_to_memcpy (but this is not a regression even 
> though this is a middle-end problem).

Are you sure?  The memcpy is already there in the generic tree (based on the dumps), and doesn't
gimplification happen later?  Also, the memcpy problem goes back to GNAT 3.15p, which is based on
gcc 2.8.1.


-- 


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug ada/19419] ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
                   ` (4 preceding siblings ...)
  2005-01-15 12:28 ` baldrick at free dot fr
@ 2005-01-15 12:34 ` steven at gcc dot gnu dot org
  2005-01-15 16:27 ` [Bug middle-end/19419] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-15 12:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-15 12:33 -------
Set to front-end bug based on observations by the reporter (as opposed to wild
guessing by someone else...)


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |ada
      Known to fail|3.3.3 4.0.0                 |3.3.3 3.4.0 4.0.0


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/19419] ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy)
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
                   ` (5 preceding siblings ...)
  2005-01-15 12:34 ` [Bug ada/19419] " steven at gcc dot gnu dot org
@ 2005-01-15 16:27 ` 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
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-15 16:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-15 16:27 -------
(In reply to comment #6)
> Set to front-end bug based on observations by the reporter (as opposed to wild
> guessing by someone else...)
I was not guessing, I actually debuged this and came up with this conclusion.  Maybe I should have said 
this before.

Also .generic in most languages is right after gimplification IFF the languages does not produce generic 
tree right away (which almost none do).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|ada                         |middle-end


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/19419] Overlapping memcpy with discriminated types
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
                   ` (6 preceding siblings ...)
  2005-01-15 16:27 ` [Bug middle-end/19419] " pinskia at gcc dot gnu dot org
@ 2005-09-12  6:14 ` ebotcazou at gcc dot gnu dot org
  2005-09-12  7:27 ` ebotcazou at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-09-12  6:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-09-12 06:14 -------
Investigating.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-07-15 21:34:21         |2005-09-12 06:14:13
               date|                            |


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug middle-end/19419] Overlapping memcpy with discriminated types
  2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
                   ` (7 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-09-12  7:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-09-12 07:25 -------
I agree with Andrew, the call to __builtin_memcpy is present in t03.gimple but
not in t02.original and is hard-wired in gimplify_modify_expr_to_memcpy:

  to_ptr = build_fold_addr_expr (to);
  args = tree_cons (NULL, to_ptr, args);
  t = implicit_built_in_decls[BUILT_IN_MEMCPY];
  t = build_function_call_expr (t, args);


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|ebotcazou at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-09-12  7:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-13  7:53 [Bug ada/19419] New: ACATS CXA4009, CXA4020 - valgrind detects bad code (overlapping memcpy) baldrick at free dot fr
2005-01-14  8:59 ` [Bug ada/19419] " baldrick at free dot fr
2005-01-14 23:23 ` 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

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).