An added non-ASCII character case breaks compiled runs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c, cpp, java, javascript
- 领域
- testing-qa, tooling
调研方向
从 web/compiler-explorer.js 中的 charLiteral 和 web/runners.js 中的 candidateTypeMatches 入手,追踪字符用例是如何生成和接受的。找到覆盖这些路径的测试,并为 é 和一个表情符号添加用例。完成标准是:添加这两个非 ASCII 字符中的任意一个都会被拒绝,并显示一条指出该字符的消息,且测试通过。
由索引模型根据 Issue 内容生成。
描述
Observed behavior
An added character case whose cell is a non-ASCII character, such as é or an emoji, is written raw between quotes by charLiteral. C and C++ never hand it over as typed, and Java does only within the Basic Multilingual Plane:
- C is built with clang on Compiler Explorer, and clang 21 (
-std=c17) refuses the literal, so the run reports a compile failure. - C++ is built with gcc there, and g++ 15 (
-std=c++20) reads'é'as a multi-character constant, warns, and the solution receives -87 instead of the character. A correct solution can fail the case silently. - Java runs on JDK 25 there, and javac 25 receives
écorrectly (233) but refuses an emoji ("character literal contains more than one UTF-16 code unit"). gino1203 reported an earlier javac that accepts it and passes only the high surrogate, 55357.
Python and JavaScript are not affected.
Expected behavior
A character case either reaches every compiled language as typed or is refused when the case is added, with a message that names the character, as an integer outside 32 bits already is.
Reproduction
At main after #683, with the checkout's web/compiler-explorer.js:
const { nativeLiteral } = await import("./web/compiler-explorer.js");
nativeLiteral("é", "character", "cpp"); // "'é'", raw UTF-8 between quotes
Compiling char c = <that literal>; printf("%d", c); gives -87 with g++ 15 and refuses to compile with clang++ 21; the same in C. Checked locally with gcc 15, clang 21 and Java 25.
Initial analysis
- Path:
charLiteralinweb/compiler-explorer.jsescapes quotes, backslashes and, after #683, U+0000 to U+001F; every other character is written as is. - Reach:
candidateTypeMatchesinweb/runners.jsaccepts any single code point as acharacter. - Domain: the six
characterjudges (copper-pad-continuity,letter-grid-tracer,letter-panel-tracing,puzzle-grid-save-check,rooftop-panel-footprint,sealed-air-pocket-backfill) take letters, digits,.,0or1, all ASCII. A C or C++charcannot hold a character outside ASCII as one value, so refusing a non-ASCIIcharacterwhen the case is added is simpler than encoding it.
Action items
- Refuse a non-ASCII
charactercase when it is added, naming the character. - Add a test that fails on
mainforéand an emoji.
Raised by gino1203 in a review of #683.
- 主要语言
- Rust
- 星标
- 228
- 派生
- 150
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 226
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/codetrial 的其他 Issue
-
Spot Capacity Round Trips tests accept the two largest rising runs可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Diagnostic category comment disagrees with its tests可能已有人在做 @woohsin 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 66/100
sysprog21/codetrial#666 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Local recording ends at Finish, before the learning review可能已有人在做 @richard81115 于 2 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 84/100
sysprog21/codetrial#663 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Task editor scroll-sync test fails intermittently in CI可能已有人在做 @melonpuff 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
sysprog21/codetrial#654 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 88/100
sysprog21/codetrial#646 · 1 条评论 ·
维护者通常 1 天内回复
查看 sysprog21/codetrial 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
asonnino/blockchain-validator#88 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
storytold/photocraft#14025 ·
维护者通常 1 天内回复
-
Extrude未关闭area:kernel bug needs-triage
难度 2/5 1-3 小时 新手友好度 62/100
bherbruck/solvecraft#16273 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 85/100
storytold/vectorcraft#7242 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复