This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix linemap_line_start (PR preprocessor/60436)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, Jason Merrill <jason at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 25 Nov 2014 10:24:19 +0100
- Subject: Re: [PATCH] Fix linemap_line_start (PR preprocessor/60436)
- Authentication-results: sourceware.org; auth=none
- References: <20141124232224 dot GL1674 at tucnak dot redhat dot com>
On Tue, Nov 25, 2014 at 12:22 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> As mentioned in the PR, when preprocessing very large files, if there are
> huge numbers of lines where no #line is emitted, we might not detect
> overflowinging into adhoc locations.
> Apparently in the add_map case we already handle that fine, by first
> stopping tracking columns and after another 256M lines give up on tracking
> locations, so this patch just makes sure we enter that path if
> going over those limits.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok.
Thanks,
Richard.
> 2014-11-24 Jakub Jelinek <jakub@redhat.com>
>
> PR preprocessor/60436
> * line-map.c (linemap_line_start): If highest is above 0x60000000
> and we are still tracking columns or highest is above 0x70000000,
> force add_map.
>
> --- libcpp/line-map.c.jj 2014-11-12 08:06:57.000000000 +0100
> +++ libcpp/line-map.c 2014-11-24 12:14:52.691276169 +0100
> @@ -529,10 +529,10 @@ linemap_line_start (struct line_maps *se
> && line_delta * ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map) > 1000)
> || (max_column_hint >= (1U << ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map)))
> || (max_column_hint <= 80
> - && ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map) >= 10))
> - {
> - add_map = true;
> - }
> + && ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map) >= 10)
> + || (highest > 0x60000000
> + && (set->max_column_hint || highest > 0x70000000)))
> + add_map = true;
> else
> max_column_hint = set->max_column_hint;
> if (add_map)
> @@ -543,7 +543,7 @@ linemap_line_start (struct line_maps *se
> /* If the column number is ridiculous or we've allocated a huge
> number of source_locations, give up on column numbers. */
> max_column_hint = 0;
> - if (highest >0x70000000)
> + if (highest > 0x70000000)
> return 0;
> column_bits = 0;
> }
>
> Jakub