public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][pushed] Remove dead code.
@ 2022-05-04 12:49 Martin Liška
  2022-05-04 13:20 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2022-05-04 12:49 UTC (permalink / raw)
  To: gcc-patches

gcc/ChangeLog:

	* gengtype-state.cc (read_a_state_token): Remove dead code.
	* ipa-profile.cc (ipa_profile_read_summary_section): Likewise.
---
 gcc/gengtype-state.cc | 22 +++++++++++-----------
 gcc/ipa-profile.cc    |  1 -
 2 files changed, 11 insertions(+), 12 deletions(-)

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;
 		case 'x':
 		  {
@@ -520,7 +520,7 @@ read_a_state_token (void)
 		      fatal_reading_state
 			(NULL_STATE_TOKEN,
 			 "Lexical error in string hex escape");
-		    c = getc (state_file);
+		    getc (state_file);
 		    break;
 		  }
 		default:
diff --git a/gcc/ipa-profile.cc b/gcc/ipa-profile.cc
index ffdcb4476e8..b74d77f2c95 100644
--- a/gcc/ipa-profile.cc
+++ b/gcc/ipa-profile.cc
@@ -481,7 +481,6 @@ ipa_profile_read_summary_section (struct lto_file_decl_data *file_data,
   for (i = 0; i < count; i++)
     {
       index = streamer_read_uhwi (ib);
-      encoder = file_data->symtab_node_encoder;
       node
 	= dyn_cast<cgraph_node *> (lto_symtab_encoder_deref (encoder, index));
 
-- 
2.36.0


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

* Re: [PATCH][pushed] Remove dead code.
  2022-05-04 12:49 [PATCH][pushed] Remove dead code Martin Liška
@ 2022-05-04 13:20 ` Andreas Schwab
  2022-05-04 14:20   ` Martin Liška
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2022-05-04 13:20 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

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?
state_writer::write_state_a_string surely doesn't suggest that.  I
suspect that this part of the code has never been exercised.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: [PATCH][pushed] Remove dead code.
  2022-05-04 13:20 ` Andreas Schwab
@ 2022-05-04 14:20   ` Martin Liška
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Liška @ 2022-05-04 14:20 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

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

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

end of thread, other threads:[~2022-05-04 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 12:49 [PATCH][pushed] Remove dead code Martin Liška
2022-05-04 13:20 ` Andreas Schwab
2022-05-04 14:20   ` Martin Liška

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).