| Summary: | [3.4/4.0 regression] ICE: Segmentation fault (program cc1plus) | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Debian GCC Maintainers <debian-gcc> |
| Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | gcc-bugs, giovannibajo, nathan |
| Priority: | P2 | Keywords: | ice-on-invalid-code |
| Version: | 3.4.4 | ||
| Target Milestone: | 3.4.4 | ||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | 3.4.3 4.0.0 | Last reconfirmed: | 2004-11-25 21:55:24 |
| Attachments: | preprocessed source | ||
|
Description
Debian GCC Maintainers
2004-11-25 21:18:37 UTC
Created attachment 7611 [details]
preprocessed source
The code is invalid but we should not be seg faulting on it.
Reduced code:
struct string {};
struct DisplayString : public string {
DisplayString() ;
DisplayString(char *s);
DisplayString(string s);
DisplayString(DisplayString& ds) ;
};
DisplayString a = "%g";
: Search converges between 2004-06-27-trunk (#473) and 2004-06-28-trunk (#474).
: Search converges between 2004-06-28-3.4 (#11) and 2004-06-29-3.4 (#12).
With the comeau online C++ compiler I get the following error:
"ComeauTest.c", line 8: error: "DisplayString::DisplayString(DisplayString &)",
required for copy that was eliminated, is not callable because
reference parameter cannot be bound to rvalue
DisplayString a = "%g";
^
which is correct.
and the reason why this is not valid code is because the "copy" construtor requires a lvalue and we
don't have a lvalue here but a rvalue.
The segfault comes from an infinite recursion which eventually causes a stack overflow. My bets are on: 2004-06-28 Nathan Sidwell <nathan@codesourcery.com> PR c++/16174 * call.c (build_temp): Declare. (check_constructor_callable): New. (reference_binding): Only set CHECK_COPY_CONSTRUCTOR if not for CONSTRUCTOR_CALLABLE. (convert_like_real, initialize_reference): Use check_constructor_callable. * cp-tree.h (LOOKUP_CONSTRUCTOR_CALLABLE): New. (LOOKUP_*): Renumber. and it's an easy win :) |