public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/114588] New: Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors
@ 2024-04-04 14:57 dmalcolm at gcc dot gnu.org
  2024-04-04 17:31 ` [Bug analyzer/114588] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-04-04 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114588
           Summary: Analyzer buffer overflow ASCII art hardcodes "RED" and
                    "GREEN" as the terminal colors
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

As noted by ycombinator user "ephaeton" here:
  https://news.ycombinator.com/item?id=39927200 

> I'd appreciate dropping red/green as bad/good colorscheme. red & green feed one of
> the most common visual impairments, and tend to work quite bad with terminal fg/bg 
> colors throughout the spectrum except for its ends (black & white). Maybe you have 
> some color profile descriptor somewhere that a user can change, but a quick search 
> through info gcc (of my installed version) just shows the ability to turn it on &
> off (-fdiagnostics-color=[auto|never|always]).
>
> Color is definitely one of the things that do NOT work well on a wide variety of
> terminals. try a white-on-firebrick VTE, or a black-on-darkgoldenrod (awesome for
> sun-glare, btw), white-on-green, white-on-purple for a change to see how well they
> mingle... 

Looking at the code, looks like I hardcoded this (in access-diagram.cc in
access_diagram_impl's ctor), rather than going through the GCC_COLORS envvar:

    /* Register painting styles.  */
    {
      style valid_style;
      valid_style.m_fg_color = style::named_color::GREEN;
      valid_style.m_bold = true;
      m_valid_style_id = m_sm.get_or_create_id (valid_style);

      style invalid_style;
      invalid_style.m_fg_color = style::named_color::RED;
      invalid_style.m_bold = true;
      m_invalid_style_id = m_sm.get_or_create_id (invalid_style);
    }

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

* [Bug analyzer/114588] Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors
  2024-04-04 14:57 [Bug analyzer/114588] New: Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors dmalcolm at gcc dot gnu.org
@ 2024-04-04 17:31 ` pinskia at gcc dot gnu.org
  2024-04-05 18:00 ` egallager at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-04 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. I should note that Red/Green is the opposite meaning in some places
than western cultures. That is Red is good and Green is bad. Most of China is
where that is true.

See
https://graphicdesign.stackexchange.com/questions/6982/except-china-which-country-will-use-red-for-up-and-green-for-down
also.

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

* [Bug analyzer/114588] Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors
  2024-04-04 14:57 [Bug analyzer/114588] New: Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors dmalcolm at gcc dot gnu.org
  2024-04-04 17:31 ` [Bug analyzer/114588] " pinskia at gcc dot gnu.org
@ 2024-04-05 18:00 ` egallager at gcc dot gnu.org
  2024-04-05 18:52 ` cvs-commit at gcc dot gnu.org
  2024-04-08 15:30 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: egallager at gcc dot gnu.org @ 2024-04-05 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Confirmed. I should note that Red/Green is the opposite meaning in some
> places than western cultures. That is Red is good and Green is bad. Most of
> China is where that is true.
> 
> See
> https://graphicdesign.stackexchange.com/questions/6982/except-china-which-
> country-will-use-red-for-up-and-green-for-down also.

Japan, too, it's why the 📈 (chart with upwards trend) emoji uses red, and the 📉
(chart with downwards trend) emoji uses blue, because they were originally from
Japan. Red = "heating up" (which is good for shares of a stock) and blue =
"cooling off" (which is bad for shares of a stock)

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

* [Bug analyzer/114588] Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors
  2024-04-04 14:57 [Bug analyzer/114588] New: Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors dmalcolm at gcc dot gnu.org
  2024-04-04 17:31 ` [Bug analyzer/114588] " pinskia at gcc dot gnu.org
  2024-04-05 18:00 ` egallager at gcc dot gnu.org
@ 2024-04-05 18:52 ` cvs-commit at gcc dot gnu.org
  2024-04-08 15:30 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-05 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:4b02dd48f531ea88587edd2b75b6e5243b4389e8

commit r14-9817-g4b02dd48f531ea88587edd2b75b6e5243b4389e8
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Fri Apr 5 14:49:53 2024 -0400

    analyzer: respect GCC_COLORS in out-of-bounds diagrams [PR114588]

    gcc/analyzer/ChangeLog:
            PR analyzer/114588
            * access-diagram.cc (access_diagram_impl::access_diagram_impl):
            Replace hardcoded colors for valid_style and invalid_style with
            calls to text_art::get_style_from_color_cap_name.

    gcc/ChangeLog:
            PR analyzer/114588
            * diagnostic-color.cc (color_dict): Add "valid" and "invalid" as
            color capability names.
            * doc/invoke.texi: Document them in description of GCC_COLORS.
            * text-art/style.cc: Include "diagnostic-color.h".
            (text_art::get_style_from_color_cap_name): New.
            * text-art/types.h (get_style_from_color_cap_name): New decl.

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

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

* [Bug analyzer/114588] Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors
  2024-04-04 14:57 [Bug analyzer/114588] New: Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors dmalcolm at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-04-05 18:52 ` cvs-commit at gcc dot gnu.org
@ 2024-04-08 15:30 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-04-08 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed by the above commit.

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

end of thread, other threads:[~2024-04-08 15:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-04 14:57 [Bug analyzer/114588] New: Analyzer buffer overflow ASCII art hardcodes "RED" and "GREEN" as the terminal colors dmalcolm at gcc dot gnu.org
2024-04-04 17:31 ` [Bug analyzer/114588] " pinskia at gcc dot gnu.org
2024-04-05 18:00 ` egallager at gcc dot gnu.org
2024-04-05 18:52 ` cvs-commit at gcc dot gnu.org
2024-04-08 15:30 ` 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).