public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent
@ 2020-03-19 21:58 qinzhao at gcc dot gnu.org
  2020-03-19 22:05 ` [Bug c/94230] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-03-19 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94230
           Summary: provide an option to change the size limitation for
                    -Wmisleading-indent
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qinzhao at gcc dot gnu.org
  Target Milestone: ---

gcc issues the following warning message for -Wmisleading-indentation:

test.c:632: note: -Wmisleading-indentation is disabled from this point 
onwards, since column-tracking was disabled due to the size of the 
code/headers 

For a file test.c on its line #632. 

please provide an option to the user to change the limitation of the size.

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
@ 2020-03-19 22:05 ` jakub at gcc dot gnu.org
  2020-03-20 14:57 ` qinzhao at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-19 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The size limitation is given from the way columns, lines, blocks and location
ranges are encoded in location_t, which is a 32-bit number.
See libcpp/include/line-map.h comment above location_t typedef.
If you have very long lines (I think more than 4095 columns), the code is badly
formatted and -Wmisleading-indentation just doesn't make sense.

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
  2020-03-19 22:05 ` [Bug c/94230] " jakub at gcc dot gnu.org
@ 2020-03-20 14:57 ` qinzhao at gcc dot gnu.org
  2020-03-20 14:59 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-03-20 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from qinzhao at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #1)
> The size limitation is given from the way columns, lines, blocks and
> location ranges are encoded in location_t, which is a 32-bit number.
> See libcpp/include/line-map.h comment above location_t typedef.
> If you have very long lines (I think more than 4095 columns), the code is
> badly formatted and -Wmisleading-indentation just doesn't make sense.

does this mean, for a 32-bit number, the size limitation cannot be changed
anymore?
if we use 64-bit number for it, will that resolve the issue?

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
  2020-03-19 22:05 ` [Bug c/94230] " jakub at gcc dot gnu.org
  2020-03-20 14:57 ` qinzhao at gcc dot gnu.org
@ 2020-03-20 14:59 ` jakub at gcc dot gnu.org
  2020-03-20 15:02 ` qinzhao at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-20 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
We do not want to use 64-bit number for that, it is used everywhere in the
compiler and would cause massive growth of compile time memory.

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-20 14:59 ` jakub at gcc dot gnu.org
@ 2020-03-20 15:02 ` qinzhao at gcc dot gnu.org
  2020-03-20 15:21 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-03-20 15:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from qinzhao at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #3)
> We do not want to use 64-bit number for that, it is used everywhere in the
> compiler and would cause massive growth of compile time memory.

understand, so, this request cannot be fixed?

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-03-20 15:02 ` qinzhao at gcc dot gnu.org
@ 2020-03-20 15:21 ` jakub at gcc dot gnu.org
  2020-03-20 16:06 ` dmalcolm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-20 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't think so, but CCing David who has changed this a lot recently.

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-03-20 15:21 ` jakub at gcc dot gnu.org
@ 2020-03-20 16:06 ` dmalcolm at gcc dot gnu.org
  2020-03-30 20:31 ` qinzhao at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-03-20 16:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
I'm not sure this has a changed a lot "recently"; I did 2-3 years ago IIRC.

The warning occurs when we have location_t > LINE_MAP_MAX_LOCATION_WITH_COLS
which means that we've run out of values for expressing locations.

If you have a huge workload, one possible workaround would be to disable range
tracking, perhaps tweaking line_table->default_range_bits, which would give you
a bit more "headroom".  IIRC we don't currently expose a way to do this, and
probably some extra code would be needed.  It's currently hardcoded to 5.

Perhaps some kind of -fno-location-ranges?  It could either:
(a) don't attempt to store location ranges  (would probably have to disable
e.g. fix-it hints)
(b) set line_table->default_range_bits to 0, so that all ranges have to go to
the ad-hoc table, but buying space for more locations.

I'm not sure if either of these are good ideas though.

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-03-20 16:06 ` dmalcolm at gcc dot gnu.org
@ 2020-03-30 20:31 ` qinzhao at gcc dot gnu.org
  2020-04-06 15:23 ` qinzhao at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-03-30 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from qinzhao at gcc dot gnu.org ---
(In reply to David Malcolm from comment #6)

> If you have a huge workload, one possible workaround would be to disable
> range tracking, perhaps tweaking line_table->default_range_bits, which would
> give you a bit more "headroom".  IIRC we don't currently expose a way to do
> this, and probably some extra code would be needed.  It's currently
> hardcoded to 5.
> 
> Perhaps some kind of -fno-location-ranges?  It could either:
> (a) don't attempt to store location ranges  (would probably have to disable
> e.g. fix-it hints)
> (b) set line_table->default_range_bits to 0, so that all ranges have to go
> to the ad-hoc table, but buying space for more locations.

I have tried the above (2) to set the line_table->default_range_bits to 0. and
used
this GCC to compile our huge application with -Wmisleading-indent, this time,
the compiler works without the warning. and there are also some proper
misleading-indent warning were emitted.

So, I'd like to add one new gcc option -fno-location-range, whose
implementation is to set line_table->default_range_bits to 0 to save more space
for column tracking.

Is this good to go?

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-03-30 20:31 ` qinzhao at gcc dot gnu.org
@ 2020-04-06 15:23 ` qinzhao at gcc dot gnu.org
  2020-05-06 17:46 ` cvs-commit at gcc dot gnu.org
  2020-05-06 18:41 ` qinzhao at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-04-06 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from qinzhao at gcc dot gnu.org ---
(In reply to David Malcolm from comment #6)
> If you have a huge workload, one possible workaround would be to disable
> range tracking, perhaps tweaking line_table->default_range_bits, which would
> give you a bit more "headroom".  IIRC we don't currently expose a way to do
> this, and probably some extra code would be needed.  It's currently
> hardcoded to 5.
> 
> Perhaps some kind of -fno-location-ranges?  It could either:
> (a) don't attempt to store location ranges  (would probably have to disable
> e.g. fix-it hints)
> (b) set line_table->default_range_bits to 0, so that all ranges have to go
> to the ad-hoc table, but buying space for more locations.
>
Hi, David,
I have sent a Patch review request to you (Cc'ing gcc-patches@gcc.gnu.org) on
4/3/2020. this patch is per your above approach b. please take a look and let
me know your opinion on it.

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-04-06 15:23 ` qinzhao at gcc dot gnu.org
@ 2020-05-06 17:46 ` cvs-commit at gcc dot gnu.org
  2020-05-06 18:41 ` qinzhao at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-06 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Qing Zhao <qinzhao@gcc.gnu.org>:

https://gcc.gnu.org/g:530b44094354758d0dea5374188caa6863647114

commit r11-146-g530b44094354758d0dea5374188caa6863647114
Author: qing zhao <qing.zhao@oracle.com>
Date:   Wed May 6 10:46:09 2020 -0700

    add a new option -flarge-source-files.

    gcc/ChangeLog:

            PR c/94230
            * common.opt: Add -flarge-source-files.
            * doc/invoke.texi: Document it.
            * toplev.c (process_options): set line_table->default_range_bits
            to 0 when flag_large_source_files is true.

    gcc/c-family/ChangeLog:

            PR c/94230
            * c-indentation.c (get_visual_column): Add a hint to use the new
            -flarge-source-files option.

    gcc/testsuite/ChangeLog:

            PR c/94230
            * gcc.dg/plugin/location-overflow-test-1.c (fn_1): New message to
            provide hint to use the new -flarge-source-files option.

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

* [Bug c/94230] provide an option to change the size limitation for -Wmisleading-indent
  2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2020-05-06 17:46 ` cvs-commit at gcc dot gnu.org
@ 2020-05-06 18:41 ` qinzhao at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-05-06 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

qinzhao at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|10.0                        |11.0
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #10 from qinzhao at gcc dot gnu.org ---
the patch has been committed to gcc11 today.
closed as fixed.

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

end of thread, other threads:[~2020-05-06 18:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 21:58 [Bug c/94230] New: provide an option to change the size limitation for -Wmisleading-indent qinzhao at gcc dot gnu.org
2020-03-19 22:05 ` [Bug c/94230] " jakub at gcc dot gnu.org
2020-03-20 14:57 ` qinzhao at gcc dot gnu.org
2020-03-20 14:59 ` jakub at gcc dot gnu.org
2020-03-20 15:02 ` qinzhao at gcc dot gnu.org
2020-03-20 15:21 ` jakub at gcc dot gnu.org
2020-03-20 16:06 ` dmalcolm at gcc dot gnu.org
2020-03-30 20:31 ` qinzhao at gcc dot gnu.org
2020-04-06 15:23 ` qinzhao at gcc dot gnu.org
2020-05-06 17:46 ` cvs-commit at gcc dot gnu.org
2020-05-06 18:41 ` qinzhao 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).