On 5/4/22 15:20, Andreas Schwab wrote:
> On Mai 04 2022, Martin Liška wrote:
> 
>> diff --git a/gcc/gengtype-state.cc b/gcc/gengtype-state.cc
>> index ea566af3249..dfd9ea52785 100644
>> --- a/gcc/gengtype-state.cc
>> +++ b/gcc/gengtype-state.cc
>> @@ -473,43 +473,43 @@ read_a_state_token (void)
>>              {
>>              case 'a':
>>                obstack_1grow (&bstring_obstack, '\a');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case 'b':
>>                obstack_1grow (&bstring_obstack, '\b');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case 't':
>>                obstack_1grow (&bstring_obstack, '\t');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case 'n':
>>                obstack_1grow (&bstring_obstack, '\n');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case 'v':
>>                obstack_1grow (&bstring_obstack, '\v');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case 'f':
>>                obstack_1grow (&bstring_obstack, '\f');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case 'r':
>>                obstack_1grow (&bstring_obstack, '\r');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case '"':
>>                obstack_1grow (&bstring_obstack, '\"');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case '\\':
>>                obstack_1grow (&bstring_obstack, '\\');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
>>              case ' ':
>>                obstack_1grow (&bstring_obstack, ' ');
>> -              c = getc (state_file);
>> +              getc (state_file);
>>                break;
> 
> This is surprising.  Does that mean that an escape sequence must always
> be followed by a character that is thrown away?

Yeah, that's bogus. There's only one string that has an escape sequence.
If I apply:

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index e3fff1f6975..982fa724af0 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -160,7 +160,7 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev 
("%h.prev_bb"))) basic_block_d
    is the better choice.  */
 typedef int __assert_gimple_bb_smaller_rtl_bb
               [(int) sizeof (struct rtl_bb_info)
-               - (int) sizeof (struct gimple_bb_info)];
+- (int) sizeof (struct gimple_bb_info)];
 
 
 #define BB_FREQ_MAX 10000

Then I end up with:

CSTR=(int) sizeof (struct rtl_bb_info)
 (int) sizeof (struct gimple_bb_info)

Where '-' is wrongly discarded.

> state_writer::write_state_a_string surely doesn't suggest that.  I
> suspect that this part of the code has never been exercised.
> 

So yes, I'm going to prepare a patch which would not skip next character.

Martin

Reply via email to