public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/115203] New: [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ
@ 2024-05-23 11:04 burnus at gcc dot gnu.org
  2024-05-23 12:41 ` [Bug analyzer/115203] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2024-05-23 11:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115203

            Bug ID: 115203
           Summary: [15 Regression] Build fail with non LANG=C in analyzer
                    self test: ICE in fail_formatted at selftest.cc:63 /
                    tree-diagnostic-path.cc:2158: test_control_flow_5:
                    FAIL: ASSERT_STREQ
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: build, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

For some testing, I happened to build with LANG=de_DE.UTF-8
and that was also set when building GCC itself.

That works fine until the analyzer self test - as the strings don't match:

.../build-gcc-trunk-fast/./gcc/xgcc
-B/home/tob/projects/build-gcc-trunk-fast/./gcc/  -xc++ -nostdinc /dev/null -S
-o /dev/null -fself-test=.../gcc/testsuite/selftests
.../gcc/tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ
("  events 1-5\n" "FILENAME:1:6:\n" "    1 |   if ((arr = (struct foo **)malloc
[...]
    5 ||    if ((arr[i] = (struct foo *)malloc(sizeof(struct foo))) == NULL) {
      ||            ~                   ~~~~~~~~~~~~~~~~~~~~~~~~~~
      ||            |                   |
      |+----------->(4) ...to here      (5) wurde hier deklariert



cc1plus: interner Compiler-Fehler: in fail_formatted, bei selftest.cc:63

0x22af256 selftest::fail_formatted(selftest::location const&, char const*, ...)
        ../../../repos/gcc/gcc/selftest.cc:63
0x22af301 selftest::assert_streq(selftest::location const&, char const*, char
const*, char const*, char const*)
        ../../../repos/gcc/gcc/selftest.cc:92
0x25b6cd6 selftest::fail_formatted(selftest::location const&, char const*, ...)
        ../../../repos/gcc/gcc/selftest.cc:63
0x25b6d81 selftest::assert_streq(selftest::location const&, char const*, char
const*, char const*, char const*)
        ../../../repos/gcc/gcc/selftest.cc:92
0x10a7b42 test_control_flow_5
        ../../../repos/gcc/gcc/tree-diagnostic-path.cc:2158
0x10aabe6 control_flow_tests
        ../../../repos/gcc/gcc/tree-diagnostic-path.cc:2292
0x13a5512 test_control_flow_5
        ../../../repos/gcc/gcc/tree-diagnostic-path.cc:2158
0x13a85b6 control_flow_tests
        ../../../repos/gcc/gcc/tree-diagnostic-path.cc:2292

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug analyzer/115203] [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ
  2024-05-23 11:04 [Bug analyzer/115203] New: [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ burnus at gcc dot gnu.org
@ 2024-05-23 12:41 ` rguenth at gcc dot gnu.org
  2024-05-23 13:39 ` dmalcolm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-23 12:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115203

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug analyzer/115203] [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ
  2024-05-23 11:04 [Bug analyzer/115203] New: [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ burnus at gcc dot gnu.org
  2024-05-23 12:41 ` [Bug analyzer/115203] " rguenth at gcc dot gnu.org
@ 2024-05-23 13:39 ` dmalcolm at gcc dot gnu.org
  2024-05-23 13:49 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-05-23 13:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115203

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-05-23

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Sorry about this; thanks for reporting it.

The translation happens here in simple_diagnostic_path::add_event:

2583      text_info ti (_(fmt), &ap, 0, nullptr, &rich_loc);
                        ^^^^^^

There's a chance that simple_diagnostic_path might get used for real purposes,
rather than just selftests, so maybe we want a flag on the
simple_diagnostic_path to suppress translation for events within it (and set it
for test_diagnostic_path).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug analyzer/115203] [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ
  2024-05-23 11:04 [Bug analyzer/115203] New: [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ burnus at gcc dot gnu.org
  2024-05-23 12:41 ` [Bug analyzer/115203] " rguenth at gcc dot gnu.org
  2024-05-23 13:39 ` dmalcolm at gcc dot gnu.org
@ 2024-05-23 13:49 ` burnus at gcc dot gnu.org
  2024-05-23 14:11 ` dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2024-05-23 13:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115203

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Indeed, the suggestion was not to disable the translations in general. A
similar issue shows up when running the testsuite. There is it solved by
"setenv LANG C" and "setenv LANG C.ASCII" – while various scripts also use
LANG=C.

Thus, one way would be to have LANG=C set somewhere (e.g. via the Makefile -
assuming it can be done portable).

Alternative would be your suggestion to disable it in simple_diagnostic_path.
Looking at gcc/intl.cc's gcc_init_libintl, you also need to watch out for
open_quote/close_quote and other fun changes as they might come before you
switch to to LANG=C.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug analyzer/115203] [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ
  2024-05-23 11:04 [Bug analyzer/115203] New: [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-23 13:49 ` burnus at gcc dot gnu.org
@ 2024-05-23 14:11 ` dmalcolm at gcc dot gnu.org
  2024-05-28 17:08 ` cvs-commit at gcc dot gnu.org
  2024-05-28 17:14 ` dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-05-23 14:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115203

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #2)
> Thus, one way would be to have LANG=C set somewhere (e.g. via the Makefile -
> assuming it can be done portable). 

I'd prefer not to do that as we may want to have selftests of i18n (though
libintl seems to have a lot of global state, which is a pain for selftests).

> Alternative would be your suggestion to disable it in simple_diagnostic_path.

I have a patch for that; it seems to work.

> Looking at gcc/intl.cc's gcc_init_libintl, you also need to watch out for
> open_quote/close_quote and other fun changes as they might come before you
> switch to to LANG=C.

FWIW we already have class auto_fix_quotes for that (see selftest.h)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug analyzer/115203] [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ
  2024-05-23 11:04 [Bug analyzer/115203] New: [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-23 14:11 ` dmalcolm at gcc dot gnu.org
@ 2024-05-28 17:08 ` cvs-commit at gcc dot gnu.org
  2024-05-28 17:14 ` dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-28 17:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115203

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:2dbb1c124c1e585dc413132d7a8d4be62c6b7baa

commit r15-866-g2dbb1c124c1e585dc413132d7a8d4be62c6b7baa
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Tue May 28 13:04:26 2024 -0400

    diagnostics: disable localization of events in selftest paths [PR115203]

    gcc/ChangeLog:
            PR analyzer/115203
            * diagnostic-path.h
            (simple_diagnostic_path::disable_event_localization): New.
            (simple_diagnostic_path::m_localize_events): New field.
            * diagnostic.cc
            (simple_diagnostic_path::simple_diagnostic_path): Initialize
            m_localize_events.
            (simple_diagnostic_path::add_event): Only localize fmt if
            m_localize_events is true.
            * tree-diagnostic-path.cc
            (test_diagnostic_path::test_diagnostic_path): Call
            disable_event_localization.

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug analyzer/115203] [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ
  2024-05-23 11:04 [Bug analyzer/115203] New: [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-28 17:08 ` cvs-commit at gcc dot gnu.org
@ 2024-05-28 17:14 ` dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-05-28 17:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115203

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed by the above patch; marking as resolved.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-28 17:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-23 11:04 [Bug analyzer/115203] New: [15 Regression] Build fail with non LANG=C in analyzer self test: ICE in fail_formatted at selftest.cc:63 / tree-diagnostic-path.cc:2158: test_control_flow_5: FAIL: ASSERT_STREQ burnus at gcc dot gnu.org
2024-05-23 12:41 ` [Bug analyzer/115203] " rguenth at gcc dot gnu.org
2024-05-23 13:39 ` dmalcolm at gcc dot gnu.org
2024-05-23 13:49 ` burnus at gcc dot gnu.org
2024-05-23 14:11 ` dmalcolm at gcc dot gnu.org
2024-05-28 17:08 ` cvs-commit at gcc dot gnu.org
2024-05-28 17:14 ` dmalcolm at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).