[Bug c/12446] New: Internal error in emit_move_insn on complicated array reference

kst at cts dot com gcc-bugzilla@gcc.gnu.org
Mon Sep 29 20:53:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Internal error in emit_move_insn on complicated array
                    reference
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kst at cts dot com
                CC: gcc-bugs at gcc dot gnu dot org

"config.guess" says i686-pc-linux-gnu

"gcc --version" says gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

command line: gcc -v -save-temps -c gcc-bug.c

Source program ("gcc-bug.c"):
========================================
struct foo {
    int arr[10];
};

static struct foo func(void)
{
    struct foo result;
    return result;
}

int main(void)
{
    int *ptr = func().arr;
    return 0;
}
========================================

"gcc-bug.i":
========================================
# 1 "gcc-bug.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "gcc-bug.c"
struct foo {
    int arr[10];
};

static struct foo func(void)
{
    struct foo result;
    return result;
}

int main(void)
{
    int *ptr = func().arr;
    return 0;
}
========================================

output:
========================================
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cpp0 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ gcc-bug.c gcc-bug.i
GNU CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cc1 -fpreprocessed gcc-bug.i -quiet -dumpbase gcc-bug.c -version -o gcc-bug.s
GNU CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (cpplib) (i386 Linux/ELF)
GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386-redhat-linux)
        compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
gcc-bug.c: In function `main':
gcc-bug.c:13: Internal compiler error in emit_move_insn, at expr.c:2776
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
========================================

I get similar results with gcc 3.2.3 on sparc-sun-solaris2.8
(expr.c:2776) and "gcc (GCC) 3.3.1 (cygming special)" on i686-pc-cygwin
(expr.c:3156).  I'll be glad to provide more detailed information if
it would be helpful.

There's some question about the legality of the line on which the error
occurs; see the "doubt in USING POINTERS" thread in the comp.std.c
newsgroup.  It's been suggested that it's legal in C99 but no in C90.
I haven't followed the discussion closely enough to have an opinion
on that, but of course an internal compiler error is a bug regardless
of whether the source is legal.



More information about the Gcc-bugs mailing list