-
Notifications
You must be signed in to change notification settings - Fork 48
Conversation
partial fix for issue D-Programming-GDC#120 (fsection-anchors) Pad out the rest of static arrays with single elements. Issue D-Programming-GDC#120 - breaks -fsection-anchors on ARM when backend calculates field positions for array members.
| @@ -347,6 +347,9 @@ | |||
| gcc_assert (TREE_CODE (TREE_TYPE (csym->Stree)) == REFERENCE_TYPE); | |||
| TREE_TYPE (csym->Stree) = TREE_TYPE (TREE_TYPE (csym->Stree)); | |||
| TREE_USED (csym->Stree) = 1; | |||
| DECL_SIZE (csym->Stree) = TYPE_SIZE (TREE_TYPE (csym->Stree)); | |||
| DECL_SIZE_UNIT (csym->Stree) = TYPE_SIZE_UNIT (TREE_TYPE (csym->Stree)); | |||
| DECL_ALIGN (csym->Stree) = TYPE_ALIGN (TREE_TYPE (csym->Stree)); | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layout_decl (csym->Stree); should do just fine.
|
OK, updated. layout_decl needs a second parameter: Is and the printf %wd complains on 32bit: is this ok or should we use some different format specifier? |
partial fix for issue D-Programming-GDC#120 (fsection-anchors)
partial fix for issue D-Programming-GDC#120 (fsection-anchors)
partial fix for issue D-Programming-GDC#120 (fsection-anchors)
partial fix for issue D-Programming-GDC#120 (fsection-anchors)
|
OK, implemented you suggestions. There are no regressions on x86, so as the check should turn those errors into ices I just assume it works on ARM (recompiling gdc and running the testsuite takes more than 10 hours). The BTW: Does GDC not use |
|
The problems in issue D-Programming-GDC#120 are caused by an initializer for a variable with a bigger size than the variables DECL_SIZE. Detect all those cases and ICE.
|
OK, it's using |
|
On 24 September 2012 11:46, Johannes Pfau notifications@github.com wrote:
I'll just check it locally my side. I think I spot one or two Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; |
|
OK, thanks. |
|
Not sure if it's problems with my set-up, or the fact that I'm using qemu emulation to test, but compiling with this patch causes segv in gc_malloc. Will try without to see what happens. |
|
On ARM only or on x86? I guess this means even a simple hello world segfaults? Sounds exectly like the first symptom related to If you try it on ARM without this test, please also try compilling druntime with But it's weird, I've run hello worlds and more advanced applications (dustmite) with those changes and everything worked fine. |
|
On 2 October 2012 13:59, Johannes Pfau notifications@github.com wrote:
|
| sym->prettyIdent ? sym->prettyIdent : sym->Sident, | ||
| declsize, typesize); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only thing itching me at the moment.
This code above: relayout_decl (t); guarantees that declsize == typesize by zero'ing out DECL_SIZE (t) and re-evaluating it. So that leaves the check for declsize < initsize, which can be changed to typesize < initsize.
if (int_size_in_bytes (TREE_TYPE (t))
< int_size_in_bytes (TREE_TYPE (DECL_INITIAL (t))))
{
internal_error ( ... );
}
#120 references an old ticketing system, so that part of the comment may be removed in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll change this as soon as I have access to my main laptop again (which should be this weekend)
|
Right, I'm gonna stamp my LTGM on this. :-) |
This pull request includes these changes to fix issue #120:
I tested those changes on x86, x64-64 and arm. There are no regressions in the test suite (which is especially important since this code introduces a new ice). Those changes produce the same testsuite output on ARM as using
-fno-section-anchors(Actually, they're even a little better. Seems like I didn't correctly pass the -fno-section-anchors to the testsuite runner). So I hope these changes should fix all section anchor issues.The testsuite results for reference: http://dl.dropbox.com/u/24218791/fix120/testsuite.html
(You might wonder why there is one more 'unresolved' runnable test with the new code on ARM: This is the runnable/test23.d test. It went from FAIL to UNRESOLVED. It now shows the same error on ARM as on X86)
Note: With this solution we don't have debug info for ClassInfos and ModuleInfos. This should really be fixed in the frontend, but that's more complicated than I thought. I'll file a bug report on the dmd bugtracker though, to make sure it won't be forgotten.