This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
more on Solaris internal compiler error
- To: egcs at cygnus dot com (egcs team)
- Subject: more on Solaris internal compiler error
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Fri, 7 Nov 97 23:45:56 PST
Earlier I reported an internal compiler error that seems to make vectors
of class objects unusable on Solaris. I reduced the problem still more,
down to the file that appears at the end of this message. I made a stab
at debugging it, and to make my life easier decided to build a cc1plus
with the old gcc (2.7.2.1) and CFLAGS=-g for easier debugging and
Purify'ing. But the resulting compiler behaves differently than the
bootstrapped, optimized compiler. The debug compiler gives
foo3.cxx:31: internal error--insn does not satisfy its constraints:
(insn 166 162 167 (set (reg/v:SI 8 %o0)
(reg/v:SI 107)) 111 {*movsi_insn} (nil)
(expr_list:REG_DEAD (reg/v:SI 107)
(nil)))
foo3.cxx:31: confused by earlier errors, bailing out
But the optimized compiler gives
foo3.cxx: In function `struct SomeClass * proc(const struct SomeClass *,
const struct SomeClass *, struct SomeClass *, struct __false_type)':
foo3.cxx:31: Internal compiler error.
foo3.cxx:31: Please submit a full bug report to `egcs-bugs@cygnus.com'.
The actual crash is a SIGBUS in reload_cse_noop_set_p .
So it occurred to me that there may be some memory access problem
(a UMR giving different behavior in optimization).
I ran the debug executable through Purify.
Sure enough, I found what looks like a serious problem in reload1.c.
The first error is a UMR in exactly the function where the crash occurs.
Now, I don't quite understand it (it looks like x has a value)
, but here's what I get:
**** Purify instrumented gnu/src/egcs-971105/gcc/cc1plus (pid 20786) ****
UMR: Uninitialized memory read:
* This is occurring while in:
reload_cse_noop_set_p [reload1.c:8036]
reload_cse_regs [reload1.c:7874]
rest_of_compilation [toplev.c:3541]
finish_function [decl.c:12332]
yyparse [parse.y:552]
compile_file [toplev.c:2513]
* Reading 4 bytes from 0xefffe414 on the stack.
* Address 0xefffe414 is local variable "x" in function reload_cse_noop_set_p.
**** Purify instrumented gnu/src/egcs-971105/gcc/cc1plus (pid 20786) ****
UMR: Uninitialized memory read:
* This is occurring while in:
reload_cse_record_set [reload1.c:8292]
reload_cse_regs [reload1.c:7885]
rest_of_compilation [toplev.c:3541]
finish_function [decl.c:12332]
yyparse [parse.y:552]
compile_file [toplev.c:2513]
* Reading 4 bytes from 0xefffe414 on the stack.
* Address 0xefffe414 is local variable "i" in function reload_cse_record_set.
The test case follows.
----------------
struct SomeClass {
int data;
};
typedef unsigned int size_t;
inline void *operator new(size_t, void *place) throw() { return place; }
struct __false_type {
};
inline void destroy(SomeClass* first, SomeClass* last)
{
for (; first < last; ++first)
first->~SomeClass();
}
SomeClass*
proc(const SomeClass* first, const SomeClass* last,
SomeClass* result, __false_type) {
SomeClass* cur = result;
try {
for ( ; first != last; ++first, ++cur)
new(cur) SomeClass(*first);
return cur;
}
catch(...) {
destroy(result, cur);
throw;
}
}