1571 – Segfault(class.c) const on function parameters not carried through to .di file

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1571 - Segfault(class.c) const on function parameters not carried through to .di file
Summary: Segfault(class.c) const on function parameters not carried through to .di file
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
Reported: 2007年10月11日 02:41 UTC by Walter Bright
Modified: 2015年06月09日 01:14 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2007年10月11日 02:41:29 UTC
class C;
void foo(const C c);
and compiling with -H gives a .di file that is missing the const.
Comment 1 Don 2009年09月10日 14:21:20 UTC
This now segfaults. crashing ClassDeclaration::toCBuffer on members->dim when members is null.
With the attached patch, as well as preventing the crash, the correct output is produced.
Patch: class.c line 735 and 749. should ensure class has members,
before writing the members out!
+if(members){
	buf->writenl();
	buf->writeByte('{');
		buf->writenl();
	for (int i = 0; i < members->dim; i++)
	{
	 Dsymbol *s = (Dsymbol *)members->data[i];
	 buf->writestring(" ");
	 s->toCBuffer(buf, hgs);
 }
 buf->writestring("}");
 + } else	buf->writestring(";");
Comment 2 Walter Bright 2009年10月06日 02:12:56 UTC
Fixed dmd 1.048 and 2.033


AltStyle によって変換されたページ (->オリジナル) /