This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/13593] New: ICE on oversized memset() of local variable


/*
 * gccbug.c -- triggers ICE in gcc-3.3.2 on powerpc-unknown-linux-gnu
 *
 * Compiling this with "gcc -O2 -c gccbug.c" results in:
 *
 * gccbug.c: In function `bug':
 * gccbug.c:46: error: Attempt to delete prologue/epilogue insn:
 * (insn/f 41 40 42 0 (nil) (set (mem:SI (plus:SI (reg/f:SI 1 r1)
 *                 (const_int 20 [0x14])) [0 S4 A8])
 *         (reg:SI 0 r0)) -1 (nil)
 *     (expr_list:REG_FRAME_RELATED_EXPR (set (mem:SI (plus:SI (reg/f:SI 1 r1)
 *                     (const_int 20 [0x14])) [0 S4 A8])
 *             (reg:SI 65 lr))
 *         (nil)))
 * gccbug.c:46: internal compiler error: in propagate_one_insn, at flow.c:1642
 *
 * Notes:
 * - Function bug() contains a programming error ("&cache" should
 *   be "cache"). Fixing it eliminates the ICE, but that's not the point.
 * - gcc-3.2.2 on powerpc does not terminate with an ICE on this code.
 * - gcc-3.3.2 on i386 does not terminate with an ICE on this code.
 */

extern void * memset(void *,int,unsigned int);

struct per_cpu_cache {
        union {
                unsigned int id;
        } k1;
        unsigned int ppc_mmcr[3];
};
struct per_cpu_cache per_cpu_cache[1];

extern int x;

static void ppc_clear_counters(void)
{
        x = 0;
}

void bug(void)
{
        struct per_cpu_cache *cache = &per_cpu_cache[0];
        memset(&cache, 0, sizeof *cache);
        ppc_clear_counters();
}

-- 
           Summary: ICE on oversized memset() of local variable
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mikpe at csd dot uu dot se
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-unknown-linux-gnu
  GCC host triplet: powerpc-unknown-linux-gnu
GCC target triplet: powerpc-unknown-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]