Repository navigation
Commit aded4fa
fix(cuda.core): reject double-dashed NVVM options at the source
Add a guard at the single exit point of _prepare_nvvm_options_impl that
raises if any option is double-dashed. libNVVM accepts only single-dashed
options, and every option on this path is generated from typed fields, so
a double dash can only mean a bug in cuda.core rather than bad user input.
Raising here names the offending option instead of leaving the user with
libNVVM's opaque NVVM_ERROR_INVALID_OPTION.
The guard is a separate cpdef helper so a test can exercise it directly;
an inline check would be unreachable and therefore unverifiable. A second
test sets every NVVM-supported field of ProgramOptions and asserts no
emitted option is double-dashed, so the invariant covers options added
later.
Verified by mutation: restoring --numba-debug turns three tests red, and
the compile test then fails with this guard's error rather than libNVVM's.
The NVRTC path keeps --numba-debug, which it accepts; the guard is scoped
to the NVVM emitter.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 42c66a8 commit aded4fa
3 files changed
Lines changed: 65 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
432 | 443 | | |
433 | 444 | | |
434 | 445 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1225 | 1225 | | |
1226 | 1226 | | |
1227 | 1227 | | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1228 | 1246 | | |
1229 | 1247 | | |
1230 | 1248 | | |
| |||
1320 | 1338 | | |
1321 | 1339 | | |
1322 | 1340 | | |
| 1341 | + | |
| 1342 | + | |
1323 | 1343 | | |
1324 | 1344 | | |
1325 | 1345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
775 | 775 | | |
776 | 776 | | |
777 | 777 | | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
778 | 812 | | |
779 | 813 | | |
780 | 814 | | |
| |||
0 commit comments