scc1 fails with an assertion when the input file is named string.d
Nobody has claimed this yet.
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
This issue was triaged from [`bugs/dan/1-d-translator-crash`](https://github.com/Macaulay2/M2/blob/388c1ff0ce30d83751dea7bc7eac77fdc1305dd7/bugs/dan/1-d-translator-crash), one of the 857 files removed from the pre-GitHub `bugs/` tree by [`d2c8d27826`](https://github.com/Macaulay2/M2/commit/d2c8d27826) and catalogued in [#36](https://github.com/Macaulay2/M2/issues/36). **The commentary below was written by Claude (Claude Opus 5, via Claude Code)**, not by @d-torrance, whose account posted it -- please weigh it accordingly.
### The original file, verbatim
```text
naming a file string.d causes the d compiler to segfault.
```
### Where it stands today
Reproduced. Copy any `.d` file to `string.d` and run `scc1` on it:
```
chk.c:1421: assertion failed
```
exit 1. Controls with identical content under other names — `notstring.d`, `foo.d`, `strings.d` —
produce ordinary "symbol never defined nor declared" diagnostics and no assertion. **So the filename
alone decides it**, which is the file's claim.
The crash mode is an assertion rather than the 2009 segfault because this build has assertions enabled;
without them it would presumably still be a segfault.
### Likely cause
`scc1` appears to derive a package name from the filename, and `string` collides with the built-in
string type — so the compiler ends up with two things of that name and trips an invariant rather than
reporting a conflict.
### Why it is worth filing despite being obscure
It is a minimal reproducer needing no rebuild, and the failure is an assertion with no useful message, so
anyone who trips it has nothing to go on. `scc1` bugs are actively tracked — #1197, #4525 and #4542 open,
#1134 and #1420 closed — and none of them is this.
`open` · disposition `issue` · source of truth: [`bug-triage/catalog.tsv`](https://github.com/d-torrance/M2/blob/bug-triage/bug-triage/catalog.tsv)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure by copying any .d file to string.d and running scc1; compare it with names such as notstring.d, foo.d, and strings.d. Start at the chk.c:1421 assertion and trace the filename-derived package name; done means string.d no longer triggers the assertion and reports a normal diagnostic instead.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100