From 024d4e13e1d33b6c4ad615b02b354d5b088ec718 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 18 Sep 2026 13:14:22 +0200 Subject: [PATCH] Add test for #13342 --- test/testtype.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/testtype.cpp b/test/testtype.cpp index a8617beb01d..1b5b57f41ca 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -617,6 +617,13 @@ class TestType : public TestFixture { " i << 2;\n" "}\n", dinit(CheckPOptions, $.settings = &s)); ASSERT_EQUALS("[test.cpp:4:7]: (error) Signed integer overflow for expression 'i<<2'. [integerOverflow]\n", errout_str()); + + checkP("void g(int a) {\n" // #13342 + " int b = INT_MAX + a;\n" + " printf(\"%d\", b); \n" + "}\n" + "void f() { g(1); }", dinit(CheckPOptions, $.settings = &s)); + ASSERT_EQUALS("[test.cpp:2:21]: (error) Signed integer overflow for expression '2147483647+a'. [integerOverflow]\n", errout_str()); } void shiftTooManyBits() { // #11496