public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55770] New: when compiling code with -fwhole-program and -fipa-matrix-reorg,compiler will produce wrong code
@ 2012-12-21  1:58 hcj20080469 at 163 dot com
  2012-12-21  2:02 ` [Bug tree-optimization/55770] " pinskia at gcc dot gnu.org
  2012-12-21 10:12 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: hcj20080469 at 163 dot com @ 2012-12-21  1:58 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55770
           Summary: when compiling code with -fwhole-program and
                    -fipa-matrix-reorg,compiler will produce wrong code
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hcj20080469@163.com


compiler version :gcc 4.7.1
--build=i586-suse-linux 
--host=i586-suse-linux
--target=i586-target-linux-gnu

test case test.c:

#include <string.h>

void __attribute__((noinline)) mem_init (void);
int **vel;
int *p;
int main (int argc, char **argv)
{
  int i, j, k;
  mem_init();
  p=malloc(4);
  *p=123;
 printf("p1:%d\n",*p);
  return 0;
}

void __attribute__((noinline))
mem_init (void)
{

  int i, j, k,d;

  d = 0;
  vel = (int **) malloc(2*sizeof(int *));
  for(i=0;i<2;i++)
    vel[i]=(int *)malloc(4*sizeof(int));
  for(i=0;i<2;i++)
        for(j=0;j<4;j++)
      vel[i][j]=i+j;

}


with command compile code
i586-target-linux-gnu-gcc test.c   -fno-ipa-matrix-reorg -fdump-tree-optimized 
-O3 -fwhole-program -fno-tree-fre -lm -S -o test-2.s

i586-target-linux-gnu-gcc test-2.s -o test-2.exe


assembling file test-2.s content following:

mem_init:
.LFB34:
    subl    $28, %esp
    movl    $8, (%esp)
    movl    $16, T.6
    movl    $32, T.7
    call    malloc # get 8 byte in the heap space 
    movl    %eax, vel
    movl    $0, (%eax)
    movl    $1, 4(%eax)
    movl    $2, 8(%eax)
    movl    $3, 12(%eax)
    movl    $1, 16(%eax)
    movl    $2, 20(%eax)
    movl    $3, 24(%eax)
    movl    $4, 28(%eax)# wring 32 byte date to the heap space
    addl    $28, %esp
    .cfi_def_cfa_offset 4
    ret
    .cfi_endproc

run the test-2.exe , give error  infomation
test-1.exe: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)
(((char *) &((av)->bins[((1) - 1) * 2])) - _0x1) && ((unsigned long)old_end &
pagemask) == 0)' failed.
Aborted


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

* [Bug tree-optimization/55770] when compiling code with -fwhole-program and -fipa-matrix-reorg,compiler will produce wrong code
  2012-12-21  1:58 [Bug c/55770] New: when compiling code with -fwhole-program and -fipa-matrix-reorg,compiler will produce wrong code hcj20080469 at 163 dot com
@ 2012-12-21  2:02 ` pinskia at gcc dot gnu.org
  2012-12-21 10:12 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-12-21  2:02 UTC (permalink / raw)
  To: gcc-bugs


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |tree-optimization
         Resolution|                            |WONTFIX
   Target Milestone|---                         |4.8.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-12-21 02:02:27 UTC ---
The option has been disabled for 4.8 and above:
r190298 | rguenth | 2012-08-10 07:19:09 -0700 (Fri, 10 Aug 2012) | 16 lines

2012-08-10  Richard Guenther  <rguenther@suse.de>

        * Makefile.in (OBJS): Remove matrix-reorg.o.
        (matrix-reorg.o): Remove dependence rule.
        (GTFILES): Remove matrix-reorg.c.
        * matrix-reorg.c: Remove.
        * passes.c (init_optimization_passes): Do not schedule
        pass_ipa_matrix_reorg.
        * tree-pass.h (pass_ipa_matrix_reorg): Remove.
        * common.opt (fipa-matrix-reorg): Stub out.
        * doc/invoke.texi (fipa-matrix-reorg): Remove documentation.

        * gcc.dg/matrix/*.c: Adjust and move ...
        * gcc.dg/torture/: ... here.
        * gcc.dg/matrix: Remove directory.


 So closing as won't fix.


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

* [Bug tree-optimization/55770] when compiling code with -fwhole-program and -fipa-matrix-reorg,compiler will produce wrong code
  2012-12-21  1:58 [Bug c/55770] New: when compiling code with -fwhole-program and -fipa-matrix-reorg,compiler will produce wrong code hcj20080469 at 163 dot com
  2012-12-21  2:02 ` [Bug tree-optimization/55770] " pinskia at gcc dot gnu.org
@ 2012-12-21 10:12 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-21 10:12 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-21 10:12:24 UTC ---
Yeah, it's very broken - don't use it.


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

end of thread, other threads:[~2012-12-21 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-21  1:58 [Bug c/55770] New: when compiling code with -fwhole-program and -fipa-matrix-reorg,compiler will produce wrong code hcj20080469 at 163 dot com
2012-12-21  2:02 ` [Bug tree-optimization/55770] " pinskia at gcc dot gnu.org
2012-12-21 10:12 ` rguenth at gcc dot gnu.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).