Skip to content

Comments

DMD Patches for three severe wrong-code bugs#1

Merged
37 commits merged intodlang:masterfrom
don-clugston-sociomantic:master
Feb 6, 2011
Merged

DMD Patches for three severe wrong-code bugs#1
37 commits merged intodlang:masterfrom
don-clugston-sociomantic:master

Conversation

@donc
Copy link
Collaborator

@donc donc commented Jan 26, 2011

I have created my own DMD repository in git@github:donc/dmd.git (so that I don't interfere with the official one). I don't know if this is the best way of doing this.

Three of the oldest and most severe wrong-code bugs:

1899 AA of fixed-length arrays fails to initialize
1914 Array initialisation from const array yields memory trample
3198 wrong initializer for structs arrays

I haven't merged the patches into the D1 branch, but I have added the tests to the test suite.
Let's see how well this works!

Don Clugston added 2 commits January 26, 2011 22:39
1914 Array initialisation from const array yields memory trample
3198 wrong initializer for structs arrays

There was an old incorrect D2-only fix for 1914 (the old fix didn't fix
all-zero array initializers). This is replaced with a general solution.
3198 is also fixed, by removing an incorrect special case for arrays.
@jmacdonagh
Copy link

Regarding "is this the best way". If you have push access to the official dmd repo (which it looks like you do), then this isn't the best way. Although it does allow us to see only your commits to dmd pretty easily, it requires more work by someone in the official repo (which might be you!) to pull in your repo and merge it in.

You're better off cloning the official repo and creating a branch. Then commit your individual changes to that branch. You can then push your local branch to a remote branch here on the official dmd repo. Walter can review the changes and merge them in (or ask you to merge them in). You get the same effect (committing without messing with master), but less work on pulling in your forked repo.

@braddr
Copy link
Member

braddr commented Jan 27, 2011

Push access != push permission. Walter pretty much owns all commits, so pull requests are probably exactly right.

Don Clugston added 5 commits January 27, 2011 08:10
1914 Array initialisation from const array yields memory trample
3198 wrong initializer for structs arrays

This is the actual compiler change. (Wasn't included in the previous
commit due to my inexperience with Git).
@donc
Copy link
Collaborator Author

donc commented Jan 27, 2011

I'm a bit surprised that after I made this pull request, my subsequent commits got added to it.
But anyway -- they're good! I've now added the D1 versions where relevant, and also added a patch by Johannes Pfau. This has the complete deal -- D1, D2, and test case.
So to incorporate all these patch, after you've done the master branch, you should pull my dmd-1.x branch as well.

Don Clugston added 20 commits January 28, 2011 08:14
D2 version.  The basic bug causes a segfault.
The special treatment with the 'getVarExp' is needed to avoid a stack overflow; this also happens in D1 (the segfault is D2-specific).
Note that we're using HTML4. When we change to HTML5, this test needs to change
to the commented-out version.
Patch by ibuclaw and aziz.koeksal
Don Clugston added 8 commits February 2, 2011 21:24
When a recursive alias declaration is encountered, mark it as
type error (not just as an alias to itself of type error).
…n't compile

Introduced on 5th Dec, in the fix for bug 5110. From the comments for 5110:
"the patch limits STC propagation via Scope's storage class (sc->stc) only to
@safe/@trusted/@System.  Other STCs such as const and synchronized are 'pulled'
by need of each member out of parent AggregateDeclaration."

This regression happened because when deducing a function template, these STCs
haven't been pulled from the parent yet. Applying the STCs doesn't happen
until FuncDeclaration::semantic. This isn't early enough for function
template matching.
So we need to complete the storage class of 'this' during matching.
It applies to const, immutable, synchronized, and shared classes.
Added here because it was broken by the patch for the test included immediately
above it. Doesn't need to run (it fails to compile on 2.051).
I've put this next to the tests for the two closely related bugs.
Govelius pushed a commit to Govelius/dmd that referenced this pull request Jul 18, 2011
Patch type-checked-arrays to compile for win32/dmc.
skl131313 pushed a commit to skl131313/dmd that referenced this pull request Jan 24, 2017
Darredevil pushed a commit to Darredevil/dmd that referenced this pull request Mar 28, 2017
Darredevil pushed a commit to Darredevil/dmd that referenced this pull request Mar 31, 2017
MartinNowak added a commit that referenced this pull request May 8, 2017
fixed visual studio build to generate VERSION instead of verstr.h
Darredevil pushed a commit to Darredevil/dmd that referenced this pull request May 17, 2017
@kinke kinke mentioned this pull request Jan 26, 2022
kinke added a commit to kinke/dmd that referenced this pull request Aug 26, 2023
I guess the recent removal of module constructors in druntime has
brought these to light, for a little LDC ASan smoke test, which
newly complains with D v2.105, e.g.:

> Direct leak of 78624 byte(s) in 126 object(s) allocated from:
>     #0 0x55606978c40d in malloc /local/mnt/workspace/tmp/final/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
>     dlang#1 0x5560698050b1 in _D2rt5minfo11ModuleGroup9sortCtorsMFNbAyaZv
RazvanN7 pushed a commit that referenced this pull request Aug 31, 2023
I guess the recent removal of module constructors in druntime has
brought these to light, for a little LDC ASan smoke test, which
newly complains with D v2.105, e.g.:

> Direct leak of 78624 byte(s) in 126 object(s) allocated from:
>     #0 0x55606978c40d in malloc /local/mnt/workspace/tmp/final/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
>     #1 0x5560698050b1 in _D2rt5minfo11ModuleGroup9sortCtorsMFNbAyaZv
thewilsonator pushed a commit that referenced this pull request Sep 11, 2025
Limit the number of platforms that this is done on.  A inspection of
some libc implementations of fork has identified the main culprits,
don't need to apply this to any others.

MacOS testsuite also regressed as a result on calling this code, it's
not clear why, but the backtrace is:
```
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x00007ff81abe6ee3 libsystem_platform.dylib`_os_unfair_lock_recursive_abort + 23
    frame #1: 0x00007ff81abe12da libsystem_platform.dylib`_os_unfair_lock_lock_slow + 247
    frame #2: 0x00007ff81abccd44 libsystem_pthread.dylib`_pthread_atfork_prepare_handlers + 48
    frame #3: 0x00007ff825dc2705 libSystem.B.dylib`libSystem_atfork_prepare + 25
    frame #4: 0x00007ff81aac17e1 libsystem_c.dylib`fork + 24
    frame #5: 0x0000000101f730ee test_runner`core.internal.backtrace.dwarf.resolveAddressesWithAtos(Location[]) + 210
```
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants