[Bug c/19423] New: -Os causes internal compiler error in gcc-3.4-20050107
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 13 13:25:00 GMT 2005
I ran the compiler
[dcb@localhost src]$ ~/gnu/20050107/results/bin/gcc -Os -c b.c
b.c: In function `__ansicon_write':
b.c:57: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I tried valgrind
[dcb@localhost src]$ ~/valgrind/results.220/bin/valgrind -q --trace-children=yes
--tool=memcheck ~/gnu/20050107/results/bin/gcc -Os -c b.c
==5131== Invalid read of size 2
==5131== at 0x8290EB5: memory_operand (recog.c:1336)
==5131== by 0x81AE70D: get_attr_memory (insn-attrtab.c:24474)
==5131== by 0x81C7BBD: result_ready_cost (insn-attrtab.c:19373)
==5131== by 0x835C78B: priority (haifa-sched.c:881)
==5131== Address 0xABABABAB is not stack'd, malloc'd or (recently) free'd
The source code is
--------------------------------------------------------------------------------
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int size_t;
typedef signed int ptrdiff_t;
typedef ptrdiff_t ssize_t;
struct curxy {
uint8_t x, y;
} __attribute__((packed));
enum ansi_state {
st_init,
st_esc,
st_csi,
};
struct term_state {
int disabled;
enum ansi_state state;
};
static struct term_state st;
static void ansicon_putchar(int ch)
{
const int rows = (*(uint8_t *)0x484) ? (*(uint8_t *)0x484)+1 : 25;
const int cols = (*(uint16_t *)0x44A);
const int page = (*(uint8_t *)0x462);
struct curxy xy = ((struct curxy *)0x450)[page];
switch ( st.state ) {
case st_init:
switch ( ch ) {
case '\b':
if ( xy.x > 0 ) xy.x--;
break;
}
break;
}
while ( xy.y >= rows ) {
}
}
ssize_t __ansicon_write( const void *buf, size_t count)
{
const unsigned char *bufp = buf;
size_t n = 0;
while ( count-- ) {
ansicon_putchar(*bufp++);
}
return n;
}
---------------------------------------------------------------------------
--
Summary: -Os causes internal compiler error in gcc-3.4-20050107
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dcb314 at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19423
More information about the Gcc-bugs
mailing list