From 75d38c6098d909cf0f3cd9e76b045f0221a33845 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 22 Oct 2026 14:31:37 -0400 Subject: [PATCH 1/2] Leave a suppressed note out of its error [GH #405] --- src/error.c | 19 ++++- .../gh-405-diag-suppress-note.txt | 19 +++++ .../tests/changes/.gh-405.rto/default.1.1.txt | 46 +++++++++++ .../changes/.gh-405.rto/default.1.matches.txt | 4 + .../tests/changes/.gh-405.rto/default.2.1.txt | 72 ++++++++++++++++ .../changes/.gh-405.rto/default.2.matches.txt | 4 + .../tests/changes/.gh-405.rto/default.3.1.txt | 75 +++++++++++++++++ .../changes/.gh-405.rto/default.3.matches.txt | 4 + .../tests/changes/.gh-405.rto/default.4.1.txt | 63 ++++++++++++++ .../changes/.gh-405.rto/default.4.matches.txt | 4 + .../tests/changes/.gh-405.rto/default.5.1.txt | 82 +++++++++++++++++++ .../changes/.gh-405.rto/default.5.matches.txt | 4 + tests/tests/changes/gh-405.sft.cpp | 44 ++++++++++ 13 files changed, 438 insertions(+), 2 deletions(-) create mode 100644 src/pending_changes/gh-405-diag-suppress-note.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.1.1.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.1.matches.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.2.1.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.2.matches.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.3.1.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.3.matches.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.4.1.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.4.matches.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.5.1.txt create mode 100644 tests/tests/changes/.gh-405.rto/default.5.matches.txt create mode 100644 tests/tests/changes/gh-405.sft.cpp diff --git a/src/error.c b/src/error.c index 769021b445..971f8d96d8 100644 --- a/src/error.c +++ b/src/error.c @@ -7679,10 +7679,25 @@ void add_more_info_list(a_diagnostic_ptr dp, a_diag_list_ptr dlp) /* Add the list of "more information" diagnostics specified by dlp to the -primary diagnostic dp. +primary diagnostic dp. An entry whose severity is es_none was suppressed +(by --diag_suppress or a diagnostic pragma for its error number): it is not +added, as a suppressed diagnostic is never displayed. The routines that write +a diagnostic have no severity to give such an entry. */ { - dp->more_info = *dlp; + a_diagnostic_ptr mi_dp; + a_diagnostic_ptr next_mi_dp; + + clear_diag_list(&dp->more_info); + for (mi_dp = dlp->head; mi_dp != NULL; mi_dp = next_mi_dp) { + next_mi_dp = mi_dp->next; + mi_dp->next = NULL; + if (mi_dp->severity == es_none) { + free_diagnostic(mi_dp); + } else { + append_to_diag_list(&dp->more_info, mi_dp); + } /* if */ + } /* for */ /* Clear the entries in the list passed in. */ clear_diag_list(dlp); } /* add_more_info_list */ diff --git a/src/pending_changes/gh-405-diag-suppress-note.txt b/src/pending_changes/gh-405-diag-suppress-note.txt new file mode 100644 index 0000000000..409d2abc82 --- /dev/null +++ b/src/pending_changes/gh-405-diag-suppress-note.txt @@ -0,0 +1,19 @@ +[GH #405] +A suppressed note of a constant-evaluation error no longer stops the front end + +When constant evaluation fails, the front end attaches notes to the error +"expression must have a constant value": "shift count is too large" (#63), +"shift count is negative" (#62), "division by zero" (#39) and "integer +operation result is out of range" (#61) among them. A note takes the severity +of its own error number, so when --diag_suppress or a diag_suppress pragma +named the number of the note, the note had a severity that could not be +displayed and the front end stopped with an internal error (in the text +output; the SARIF output listed the suppressed note as a related location): + + constexpr int z = 1 << 32; + // --diag_suppress=63: internal error: assertion failed: + // determine_severity_code: bad severity + +A suppressed note is now left out of the diagnostic, as a suppressed +diagnostic always is, in the SARIF output too. The error itself is still +reported. diff --git a/tests/tests/changes/.gh-405.rto/default.1.1.txt b/tests/tests/changes/.gh-405.rto/default.1.1.txt new file mode 100644 index 0000000000..cb9b84bb3f --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.1.1.txt @@ -0,0 +1,46 @@ +fe_only -DTEST_NUMBER=1 --c++20 --diag_suppress=39,62,63 Test_name.c +"Test_name.c", line 27: error: expression must have a constant value + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: error: expression must have a constant value + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: error: expression must have a constant value + constexpr int divide_by_zero = 10 / 0; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 33: error: expression must have a constant value + int array_bound[1 << 32]; + ^ + +"Test_name.c", line 35: error: expression must have a constant value + static_assert((1 << 33) == 0); + ^ + +"Test_name.c", line 38: error: expression must have a constant value + S<1 << 34> s; + ^ + +"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced + constexpr int divide_by_zero = 10 / 0; + ^ + +8 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.gh-405.rto/default.1.matches.txt b/tests/tests/changes/.gh-405.rto/default.1.matches.txt new file mode 100644 index 0000000000..c03b10f463 --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.1.matches.txt @@ -0,0 +1,4 @@ +Matches for "\A(?![\s\S]*internal error)": + <----------------------------------------------------------------------------- + + -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/.gh-405.rto/default.2.1.txt b/tests/tests/changes/.gh-405.rto/default.2.1.txt new file mode 100644 index 0000000000..b3046daf2c --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.2.1.txt @@ -0,0 +1,72 @@ +fe_only -DTEST_NUMBER=2 --c++20 --diag_suppress=39 Test_name.c +"Test_name.c", line 27: error: expression must have a constant value + constexpr int shift_too_large = 1 << 32; + ^ +"Test_name.c", line 27: note: shift count is too large + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: error: expression must have a constant value + constexpr int shift_negative = 1 << -1; + ^ +"Test_name.c", line 28: note: shift count is negative + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: error: expression must have a constant value + constexpr int divide_by_zero = 10 / 0; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ +"Test_name.c", line 31: note: shift count is too large + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 33: error: expression must have a constant value + int array_bound[1 << 32]; + ^ +"Test_name.c", line 33: note: shift count is too large + int array_bound[1 << 32]; + ^ + +"Test_name.c", line 35: error: expression must have a constant value + static_assert((1 << 33) == 0); + ^ +"Test_name.c", line 35: note: shift count is too large + static_assert((1 << 33) == 0); + ^ + +"Test_name.c", line 38: error: expression must have a constant value + S<1 << 34> s; + ^ +"Test_name.c", line 38: note: shift count is too large + S<1 << 34> s; + ^ + +"Test_name.c", line 43: warning: shift count is too large + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 43: warning: shift count is negative + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced + constexpr int divide_by_zero = 10 / 0; + ^ + +8 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.gh-405.rto/default.2.matches.txt b/tests/tests/changes/.gh-405.rto/default.2.matches.txt new file mode 100644 index 0000000000..c03b10f463 --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.2.matches.txt @@ -0,0 +1,4 @@ +Matches for "\A(?![\s\S]*internal error)": + <----------------------------------------------------------------------------- + + -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/.gh-405.rto/default.3.1.txt b/tests/tests/changes/.gh-405.rto/default.3.1.txt new file mode 100644 index 0000000000..1661eef5a2 --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.3.1.txt @@ -0,0 +1,75 @@ +fe_only -DTEST_NUMBER=3 --c++20 --diag_suppress=62 Test_name.c +"Test_name.c", line 27: error: expression must have a constant value + constexpr int shift_too_large = 1 << 32; + ^ +"Test_name.c", line 27: note: shift count is too large + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: error: expression must have a constant value + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: error: expression must have a constant value + constexpr int divide_by_zero = 10 / 0; + ^ +"Test_name.c", line 29: note: division by zero + constexpr int divide_by_zero = 10 / 0; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ +"Test_name.c", line 31: note: shift count is too large + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ +"Test_name.c", line 31: note: division by zero + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 33: error: expression must have a constant value + int array_bound[1 << 32]; + ^ +"Test_name.c", line 33: note: shift count is too large + int array_bound[1 << 32]; + ^ + +"Test_name.c", line 35: error: expression must have a constant value + static_assert((1 << 33) == 0); + ^ +"Test_name.c", line 35: note: shift count is too large + static_assert((1 << 33) == 0); + ^ + +"Test_name.c", line 38: error: expression must have a constant value + S<1 << 34> s; + ^ +"Test_name.c", line 38: note: shift count is too large + S<1 << 34> s; + ^ + +"Test_name.c", line 43: warning: shift count is too large + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 43: warning: division by zero + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced + constexpr int divide_by_zero = 10 / 0; + ^ + +8 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.gh-405.rto/default.3.matches.txt b/tests/tests/changes/.gh-405.rto/default.3.matches.txt new file mode 100644 index 0000000000..c03b10f463 --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.3.matches.txt @@ -0,0 +1,4 @@ +Matches for "\A(?![\s\S]*internal error)": + <----------------------------------------------------------------------------- + + -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/.gh-405.rto/default.4.1.txt b/tests/tests/changes/.gh-405.rto/default.4.1.txt new file mode 100644 index 0000000000..4ba0967ab9 --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.4.1.txt @@ -0,0 +1,63 @@ +fe_only -DTEST_NUMBER=4 --c++20 --diag_suppress=63 Test_name.c +"Test_name.c", line 27: error: expression must have a constant value + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: error: expression must have a constant value + constexpr int shift_negative = 1 << -1; + ^ +"Test_name.c", line 28: note: shift count is negative + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: error: expression must have a constant value + constexpr int divide_by_zero = 10 / 0; + ^ +"Test_name.c", line 29: note: division by zero + constexpr int divide_by_zero = 10 / 0; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ +"Test_name.c", line 31: note: division by zero + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 33: error: expression must have a constant value + int array_bound[1 << 32]; + ^ + +"Test_name.c", line 35: error: expression must have a constant value + static_assert((1 << 33) == 0); + ^ + +"Test_name.c", line 38: error: expression must have a constant value + S<1 << 34> s; + ^ + +"Test_name.c", line 43: warning: division by zero + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 43: warning: shift count is negative + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced + constexpr int divide_by_zero = 10 / 0; + ^ + +8 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.gh-405.rto/default.4.matches.txt b/tests/tests/changes/.gh-405.rto/default.4.matches.txt new file mode 100644 index 0000000000..c03b10f463 --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.4.matches.txt @@ -0,0 +1,4 @@ +Matches for "\A(?![\s\S]*internal error)": + <----------------------------------------------------------------------------- + + -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/.gh-405.rto/default.5.1.txt b/tests/tests/changes/.gh-405.rto/default.5.1.txt new file mode 100644 index 0000000000..ccbd6be63d --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.5.1.txt @@ -0,0 +1,82 @@ +fe_only -DTEST_NUMBER=5 --c++20 Test_name.c +"Test_name.c", line 27: error: expression must have a constant value + constexpr int shift_too_large = 1 << 32; + ^ +"Test_name.c", line 27: note: shift count is too large + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: error: expression must have a constant value + constexpr int shift_negative = 1 << -1; + ^ +"Test_name.c", line 28: note: shift count is negative + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: error: expression must have a constant value + constexpr int divide_by_zero = 10 / 0; + ^ +"Test_name.c", line 29: note: division by zero + constexpr int divide_by_zero = 10 / 0; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ +"Test_name.c", line 31: note: shift count is too large + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 31: error: expression must have a constant value + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ +"Test_name.c", line 31: note: division by zero + enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + ^ + +"Test_name.c", line 33: error: expression must have a constant value + int array_bound[1 << 32]; + ^ +"Test_name.c", line 33: note: shift count is too large + int array_bound[1 << 32]; + ^ + +"Test_name.c", line 35: error: expression must have a constant value + static_assert((1 << 33) == 0); + ^ +"Test_name.c", line 35: note: shift count is too large + static_assert((1 << 33) == 0); + ^ + +"Test_name.c", line 38: error: expression must have a constant value + S<1 << 34> s; + ^ +"Test_name.c", line 38: note: shift count is too large + S<1 << 34> s; + ^ + +"Test_name.c", line 43: warning: shift count is too large + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 43: warning: division by zero + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 43: warning: shift count is negative + return (x << 40) + (x / 0) + (x << -1); + ^ + +"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced + constexpr int shift_too_large = 1 << 32; + ^ + +"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced + constexpr int shift_negative = 1 << -1; + ^ + +"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced + constexpr int divide_by_zero = 10 / 0; + ^ + +8 errors detected in the compilation of "Test_name.c". diff --git a/tests/tests/changes/.gh-405.rto/default.5.matches.txt b/tests/tests/changes/.gh-405.rto/default.5.matches.txt new file mode 100644 index 0000000000..c03b10f463 --- /dev/null +++ b/tests/tests/changes/.gh-405.rto/default.5.matches.txt @@ -0,0 +1,4 @@ +Matches for "\A(?![\s\S]*internal error)": + <----------------------------------------------------------------------------- + + -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/gh-405.sft.cpp b/tests/tests/changes/gh-405.sft.cpp new file mode 100644 index 0000000000..214ca992e6 --- /dev/null +++ b/tests/tests/changes/gh-405.sft.cpp @@ -0,0 +1,44 @@ +//type:fn +//options:--diag_suppress=39,62,63:--diag_suppress=39:--diag_suppress=62:--diag_suppress=63: +//options_all:--c++20 +//remark:[GH #405] A suppressed note of an error no longer stops the front end +//match_regex:\A(?![\s\S]*internal error) +// 10/22/26 [GH #405] +// +// When constant evaluation fails, the interpreter attaches notes to the +// error "expression must have a constant value": #63 (shift count is too +// large), #62 (shift count is negative) and #39 (division by zero) here. A +// note takes the severity of its own error number, so with --diag_suppress +// (or a diag_suppress pragma) naming one of them the note had a severity +// that cannot be displayed, and the front end stopped with an internal +// error: +// +// internal error #2656: assertion failed: determine_severity_code: +// bad severity +// +// A suppressed note is now left out of the diagnostic, as a suppressed +// diagnostic always is. The error itself is still reported. +// +// The five option sets compile the same source: all three numbers +// suppressed, each one alone, and none (the notes are shown). Every +// constant below is an error in every set; only the notes of the suppressed +// numbers are absent. + +constexpr int shift_too_large = 1 << 32; +constexpr int shift_negative = 1 << -1; +constexpr int divide_by_zero = 10 / 0; + +enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; + +int array_bound[1 << 32]; + +static_assert((1 << 33) == 0); + +template struct S {}; +S<1 << 34> s; + +int f(int x) { + // Not constant expressions: only warnings, and only for the numbers that + // are not suppressed (set 1 suppresses all three, set 5 none of them). + return (x << 40) + (x / 0) + (x << -1); +} From 5f2fc69284cd7d26709cb3c7076b171f835a1208 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Wed, 28 Oct 2026 14:56:06 -0400 Subject: [PATCH 2/2] Remove regex files [] --- .../tests/changes/.gh-405.rto/default.1.1.txt | 22 +++++----- .../changes/.gh-405.rto/default.1.matches.txt | 4 -- .../tests/changes/.gh-405.rto/default.2.1.txt | 38 ++++++++-------- .../changes/.gh-405.rto/default.2.matches.txt | 4 -- .../tests/changes/.gh-405.rto/default.3.1.txt | 40 ++++++++--------- .../changes/.gh-405.rto/default.3.matches.txt | 4 -- .../tests/changes/.gh-405.rto/default.4.1.txt | 32 +++++++------- .../changes/.gh-405.rto/default.4.matches.txt | 4 -- .../tests/changes/.gh-405.rto/default.5.1.txt | 44 +++++++++---------- .../changes/.gh-405.rto/default.5.matches.txt | 4 -- tests/tests/changes/gh-405.sft.cpp | 1 - 11 files changed, 88 insertions(+), 109 deletions(-) delete mode 100644 tests/tests/changes/.gh-405.rto/default.1.matches.txt delete mode 100644 tests/tests/changes/.gh-405.rto/default.2.matches.txt delete mode 100644 tests/tests/changes/.gh-405.rto/default.3.matches.txt delete mode 100644 tests/tests/changes/.gh-405.rto/default.4.matches.txt delete mode 100644 tests/tests/changes/.gh-405.rto/default.5.matches.txt diff --git a/tests/tests/changes/.gh-405.rto/default.1.1.txt b/tests/tests/changes/.gh-405.rto/default.1.1.txt index cb9b84bb3f..4d5f81af90 100644 --- a/tests/tests/changes/.gh-405.rto/default.1.1.txt +++ b/tests/tests/changes/.gh-405.rto/default.1.1.txt @@ -1,45 +1,45 @@ fe_only -DTEST_NUMBER=1 --c++20 --diag_suppress=39,62,63 Test_name.c -"Test_name.c", line 27: error: expression must have a constant value +"Test_name.c", line 26: error: expression must have a constant value constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: error: expression must have a constant value +"Test_name.c", line 27: error: expression must have a constant value constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: error: expression must have a constant value +"Test_name.c", line 28: error: expression must have a constant value constexpr int divide_by_zero = 10 / 0; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 33: error: expression must have a constant value +"Test_name.c", line 32: error: expression must have a constant value int array_bound[1 << 32]; ^ -"Test_name.c", line 35: error: expression must have a constant value +"Test_name.c", line 34: error: expression must have a constant value static_assert((1 << 33) == 0); ^ -"Test_name.c", line 38: error: expression must have a constant value +"Test_name.c", line 37: error: expression must have a constant value S<1 << 34> s; ^ -"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced +"Test_name.c", line 26: warning: variable "shift_too_large" was declared but never referenced constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced +"Test_name.c", line 27: warning: variable "shift_negative" was declared but never referenced constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced +"Test_name.c", line 28: warning: variable "divide_by_zero" was declared but never referenced constexpr int divide_by_zero = 10 / 0; ^ diff --git a/tests/tests/changes/.gh-405.rto/default.1.matches.txt b/tests/tests/changes/.gh-405.rto/default.1.matches.txt deleted file mode 100644 index c03b10f463..0000000000 --- a/tests/tests/changes/.gh-405.rto/default.1.matches.txt +++ /dev/null @@ -1,4 +0,0 @@ -Matches for "\A(?![\s\S]*internal error)": - <----------------------------------------------------------------------------- - - -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/.gh-405.rto/default.2.1.txt b/tests/tests/changes/.gh-405.rto/default.2.1.txt index b3046daf2c..dd1f40e473 100644 --- a/tests/tests/changes/.gh-405.rto/default.2.1.txt +++ b/tests/tests/changes/.gh-405.rto/default.2.1.txt @@ -1,71 +1,71 @@ fe_only -DTEST_NUMBER=2 --c++20 --diag_suppress=39 Test_name.c -"Test_name.c", line 27: error: expression must have a constant value +"Test_name.c", line 26: error: expression must have a constant value constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 27: note: shift count is too large +"Test_name.c", line 26: note: shift count is too large constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: error: expression must have a constant value +"Test_name.c", line 27: error: expression must have a constant value constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 28: note: shift count is negative +"Test_name.c", line 27: note: shift count is negative constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: error: expression must have a constant value +"Test_name.c", line 28: error: expression must have a constant value constexpr int divide_by_zero = 10 / 0; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: note: shift count is too large +"Test_name.c", line 30: note: shift count is too large enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 33: error: expression must have a constant value +"Test_name.c", line 32: error: expression must have a constant value int array_bound[1 << 32]; ^ -"Test_name.c", line 33: note: shift count is too large +"Test_name.c", line 32: note: shift count is too large int array_bound[1 << 32]; ^ -"Test_name.c", line 35: error: expression must have a constant value +"Test_name.c", line 34: error: expression must have a constant value static_assert((1 << 33) == 0); ^ -"Test_name.c", line 35: note: shift count is too large +"Test_name.c", line 34: note: shift count is too large static_assert((1 << 33) == 0); ^ -"Test_name.c", line 38: error: expression must have a constant value +"Test_name.c", line 37: error: expression must have a constant value S<1 << 34> s; ^ -"Test_name.c", line 38: note: shift count is too large +"Test_name.c", line 37: note: shift count is too large S<1 << 34> s; ^ -"Test_name.c", line 43: warning: shift count is too large +"Test_name.c", line 42: warning: shift count is too large return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 43: warning: shift count is negative +"Test_name.c", line 42: warning: shift count is negative return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced +"Test_name.c", line 26: warning: variable "shift_too_large" was declared but never referenced constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced +"Test_name.c", line 27: warning: variable "shift_negative" was declared but never referenced constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced +"Test_name.c", line 28: warning: variable "divide_by_zero" was declared but never referenced constexpr int divide_by_zero = 10 / 0; ^ diff --git a/tests/tests/changes/.gh-405.rto/default.2.matches.txt b/tests/tests/changes/.gh-405.rto/default.2.matches.txt deleted file mode 100644 index c03b10f463..0000000000 --- a/tests/tests/changes/.gh-405.rto/default.2.matches.txt +++ /dev/null @@ -1,4 +0,0 @@ -Matches for "\A(?![\s\S]*internal error)": - <----------------------------------------------------------------------------- - - -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/.gh-405.rto/default.3.1.txt b/tests/tests/changes/.gh-405.rto/default.3.1.txt index 1661eef5a2..ff96a326a4 100644 --- a/tests/tests/changes/.gh-405.rto/default.3.1.txt +++ b/tests/tests/changes/.gh-405.rto/default.3.1.txt @@ -1,74 +1,74 @@ fe_only -DTEST_NUMBER=3 --c++20 --diag_suppress=62 Test_name.c -"Test_name.c", line 27: error: expression must have a constant value +"Test_name.c", line 26: error: expression must have a constant value constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 27: note: shift count is too large +"Test_name.c", line 26: note: shift count is too large constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: error: expression must have a constant value +"Test_name.c", line 27: error: expression must have a constant value constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: error: expression must have a constant value +"Test_name.c", line 28: error: expression must have a constant value constexpr int divide_by_zero = 10 / 0; ^ -"Test_name.c", line 29: note: division by zero +"Test_name.c", line 28: note: division by zero constexpr int divide_by_zero = 10 / 0; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: note: shift count is too large +"Test_name.c", line 30: note: shift count is too large enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: note: division by zero +"Test_name.c", line 30: note: division by zero enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 33: error: expression must have a constant value +"Test_name.c", line 32: error: expression must have a constant value int array_bound[1 << 32]; ^ -"Test_name.c", line 33: note: shift count is too large +"Test_name.c", line 32: note: shift count is too large int array_bound[1 << 32]; ^ -"Test_name.c", line 35: error: expression must have a constant value +"Test_name.c", line 34: error: expression must have a constant value static_assert((1 << 33) == 0); ^ -"Test_name.c", line 35: note: shift count is too large +"Test_name.c", line 34: note: shift count is too large static_assert((1 << 33) == 0); ^ -"Test_name.c", line 38: error: expression must have a constant value +"Test_name.c", line 37: error: expression must have a constant value S<1 << 34> s; ^ -"Test_name.c", line 38: note: shift count is too large +"Test_name.c", line 37: note: shift count is too large S<1 << 34> s; ^ -"Test_name.c", line 43: warning: shift count is too large +"Test_name.c", line 42: warning: shift count is too large return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 43: warning: division by zero +"Test_name.c", line 42: warning: division by zero return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced +"Test_name.c", line 26: warning: variable "shift_too_large" was declared but never referenced constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced +"Test_name.c", line 27: warning: variable "shift_negative" was declared but never referenced constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced +"Test_name.c", line 28: warning: variable "divide_by_zero" was declared but never referenced constexpr int divide_by_zero = 10 / 0; ^ diff --git a/tests/tests/changes/.gh-405.rto/default.3.matches.txt b/tests/tests/changes/.gh-405.rto/default.3.matches.txt deleted file mode 100644 index c03b10f463..0000000000 --- a/tests/tests/changes/.gh-405.rto/default.3.matches.txt +++ /dev/null @@ -1,4 +0,0 @@ -Matches for "\A(?![\s\S]*internal error)": - <----------------------------------------------------------------------------- - - -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/.gh-405.rto/default.4.1.txt b/tests/tests/changes/.gh-405.rto/default.4.1.txt index 4ba0967ab9..e88d6685c7 100644 --- a/tests/tests/changes/.gh-405.rto/default.4.1.txt +++ b/tests/tests/changes/.gh-405.rto/default.4.1.txt @@ -1,62 +1,62 @@ fe_only -DTEST_NUMBER=4 --c++20 --diag_suppress=63 Test_name.c -"Test_name.c", line 27: error: expression must have a constant value +"Test_name.c", line 26: error: expression must have a constant value constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: error: expression must have a constant value +"Test_name.c", line 27: error: expression must have a constant value constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 28: note: shift count is negative +"Test_name.c", line 27: note: shift count is negative constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: error: expression must have a constant value +"Test_name.c", line 28: error: expression must have a constant value constexpr int divide_by_zero = 10 / 0; ^ -"Test_name.c", line 29: note: division by zero +"Test_name.c", line 28: note: division by zero constexpr int divide_by_zero = 10 / 0; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: note: division by zero +"Test_name.c", line 30: note: division by zero enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 33: error: expression must have a constant value +"Test_name.c", line 32: error: expression must have a constant value int array_bound[1 << 32]; ^ -"Test_name.c", line 35: error: expression must have a constant value +"Test_name.c", line 34: error: expression must have a constant value static_assert((1 << 33) == 0); ^ -"Test_name.c", line 38: error: expression must have a constant value +"Test_name.c", line 37: error: expression must have a constant value S<1 << 34> s; ^ -"Test_name.c", line 43: warning: division by zero +"Test_name.c", line 42: warning: division by zero return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 43: warning: shift count is negative +"Test_name.c", line 42: warning: shift count is negative return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced +"Test_name.c", line 26: warning: variable "shift_too_large" was declared but never referenced constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced +"Test_name.c", line 27: warning: variable "shift_negative" was declared but never referenced constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced +"Test_name.c", line 28: warning: variable "divide_by_zero" was declared but never referenced constexpr int divide_by_zero = 10 / 0; ^ diff --git a/tests/tests/changes/.gh-405.rto/default.4.matches.txt b/tests/tests/changes/.gh-405.rto/default.4.matches.txt deleted file mode 100644 index c03b10f463..0000000000 --- a/tests/tests/changes/.gh-405.rto/default.4.matches.txt +++ /dev/null @@ -1,4 +0,0 @@ -Matches for "\A(?![\s\S]*internal error)": - <----------------------------------------------------------------------------- - - -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/.gh-405.rto/default.5.1.txt b/tests/tests/changes/.gh-405.rto/default.5.1.txt index ccbd6be63d..53a0ea8ae9 100644 --- a/tests/tests/changes/.gh-405.rto/default.5.1.txt +++ b/tests/tests/changes/.gh-405.rto/default.5.1.txt @@ -1,81 +1,81 @@ fe_only -DTEST_NUMBER=5 --c++20 Test_name.c -"Test_name.c", line 27: error: expression must have a constant value +"Test_name.c", line 26: error: expression must have a constant value constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 27: note: shift count is too large +"Test_name.c", line 26: note: shift count is too large constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: error: expression must have a constant value +"Test_name.c", line 27: error: expression must have a constant value constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 28: note: shift count is negative +"Test_name.c", line 27: note: shift count is negative constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: error: expression must have a constant value +"Test_name.c", line 28: error: expression must have a constant value constexpr int divide_by_zero = 10 / 0; ^ -"Test_name.c", line 29: note: division by zero +"Test_name.c", line 28: note: division by zero constexpr int divide_by_zero = 10 / 0; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: note: shift count is too large +"Test_name.c", line 30: note: shift count is too large enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: error: expression must have a constant value +"Test_name.c", line 30: error: expression must have a constant value enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 31: note: division by zero +"Test_name.c", line 30: note: division by zero enum { E_shift_too_large = 1 << 32, E_divide_by_zero = 10 / 0 }; ^ -"Test_name.c", line 33: error: expression must have a constant value +"Test_name.c", line 32: error: expression must have a constant value int array_bound[1 << 32]; ^ -"Test_name.c", line 33: note: shift count is too large +"Test_name.c", line 32: note: shift count is too large int array_bound[1 << 32]; ^ -"Test_name.c", line 35: error: expression must have a constant value +"Test_name.c", line 34: error: expression must have a constant value static_assert((1 << 33) == 0); ^ -"Test_name.c", line 35: note: shift count is too large +"Test_name.c", line 34: note: shift count is too large static_assert((1 << 33) == 0); ^ -"Test_name.c", line 38: error: expression must have a constant value +"Test_name.c", line 37: error: expression must have a constant value S<1 << 34> s; ^ -"Test_name.c", line 38: note: shift count is too large +"Test_name.c", line 37: note: shift count is too large S<1 << 34> s; ^ -"Test_name.c", line 43: warning: shift count is too large +"Test_name.c", line 42: warning: shift count is too large return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 43: warning: division by zero +"Test_name.c", line 42: warning: division by zero return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 43: warning: shift count is negative +"Test_name.c", line 42: warning: shift count is negative return (x << 40) + (x / 0) + (x << -1); ^ -"Test_name.c", line 27: warning: variable "shift_too_large" was declared but never referenced +"Test_name.c", line 26: warning: variable "shift_too_large" was declared but never referenced constexpr int shift_too_large = 1 << 32; ^ -"Test_name.c", line 28: warning: variable "shift_negative" was declared but never referenced +"Test_name.c", line 27: warning: variable "shift_negative" was declared but never referenced constexpr int shift_negative = 1 << -1; ^ -"Test_name.c", line 29: warning: variable "divide_by_zero" was declared but never referenced +"Test_name.c", line 28: warning: variable "divide_by_zero" was declared but never referenced constexpr int divide_by_zero = 10 / 0; ^ diff --git a/tests/tests/changes/.gh-405.rto/default.5.matches.txt b/tests/tests/changes/.gh-405.rto/default.5.matches.txt deleted file mode 100644 index c03b10f463..0000000000 --- a/tests/tests/changes/.gh-405.rto/default.5.matches.txt +++ /dev/null @@ -1,4 +0,0 @@ -Matches for "\A(?![\s\S]*internal error)": - <----------------------------------------------------------------------------- - - -----------------------------------------------------------------------------> diff --git a/tests/tests/changes/gh-405.sft.cpp b/tests/tests/changes/gh-405.sft.cpp index 214ca992e6..0fa2f25830 100644 --- a/tests/tests/changes/gh-405.sft.cpp +++ b/tests/tests/changes/gh-405.sft.cpp @@ -2,7 +2,6 @@ //options:--diag_suppress=39,62,63:--diag_suppress=39:--diag_suppress=62:--diag_suppress=63: //options_all:--c++20 //remark:[GH #405] A suppressed note of an error no longer stops the front end -//match_regex:\A(?![\s\S]*internal error) // 10/22/26 [GH #405] // // When constant evaluation fails, the interpreter attaches notes to the