Re: [PATCH][ICE] Fix for PR107193.

2022-10-10 Thread Jeff Law via Gcc-patches



On 10/10/22 18:36, Eugene Rozenfeld via Gcc-patches wrote:

The bug was introduced in f30e9fd33e56a5a721346ea6140722e1b193db42.
A variable (cur_locus_e) was incorrectly declared inside a loop.
I also moved two other declarations (last and locus) down to make
the code more clear.

Tested on x86_64-pc-linux-gnu.

gcc/ChangeLog:
PR debug/107193
* tree-cfg.cc (assign_discriminators): Move declaration of cur_locus_e
out of the loop.


Thanks.  I suspect this caused the hppa bootstrap failure due to 
comparison mismatch as well.  Given it's an 8hr build, I'm inclined to 
just restart it once this patch goes in and hope rather than bisect :-)



jeff




Re: [PATCH][ICE] Fix for PR107193.

2022-10-10 Thread Jason Merrill via Gcc-patches

On 10/10/22 20:36, Eugene Rozenfeld wrote:

The bug was introduced in f30e9fd33e56a5a721346ea6140722e1b193db42.
A variable (cur_locus_e) was incorrectly declared inside a loop.
I also moved two other declarations (last and locus) down to make
the code more clear.

Tested on x86_64-pc-linux-gnu.


OK.


gcc/ChangeLog:
PR debug/107193
* tree-cfg.cc (assign_discriminators): Move declaration of cur_locus_e
out of the loop.
---
  gcc/tree-cfg.cc | 7 ---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index 41f2925665f..ae781871a19 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -1204,9 +1204,8 @@ assign_discriminators (void)
edge e;
edge_iterator ei;
gimple_stmt_iterator gsi;
-  gimple *last = last_stmt (bb);
-  location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
location_t curr_locus = UNKNOWN_LOCATION;
+  expanded_location curr_locus_e = {};
int curr_discr = 0;
  
/* Traverse the basic block, if two function calls within a basic block

@@ -1215,7 +1214,7 @@ assign_discriminators (void)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next ())
{
  gimple *stmt = gsi_stmt (gsi);
- expanded_location curr_locus_e;
+
  if (curr_locus == UNKNOWN_LOCATION)
{
  curr_locus = gimple_location (stmt);
@@ -1238,6 +1237,8 @@ assign_discriminators (void)
curr_discr = next_discriminator_for_locus (curr_locus);
}
  
+  gimple *last = last_stmt (bb);

+  location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
if (locus == UNKNOWN_LOCATION)
continue;
  




Re: [PATCH][ICE] Fix for PR107193.

2022-10-10 Thread H.J. Lu via Gcc-patches
On Mon, Oct 10, 2022 at 5:37 PM Eugene Rozenfeld
 wrote:
>
> The bug was introduced in f30e9fd33e56a5a721346ea6140722e1b193db42.
> A variable (cur_locus_e) was incorrectly declared inside a loop.
> I also moved two other declarations (last and locus) down to make
> the code more clear.
>
> Tested on x86_64-pc-linux-gnu.
>
> gcc/ChangeLog:
> PR debug/107193
> * tree-cfg.cc (assign_discriminators): Move declaration of cur_locus_e
> out of the loop.
> ---
>  gcc/tree-cfg.cc | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
> index 41f2925665f..ae781871a19 100644
> --- a/gcc/tree-cfg.cc
> +++ b/gcc/tree-cfg.cc
> @@ -1204,9 +1204,8 @@ assign_discriminators (void)
>edge e;
>edge_iterator ei;
>gimple_stmt_iterator gsi;
> -  gimple *last = last_stmt (bb);
> -  location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
>location_t curr_locus = UNKNOWN_LOCATION;
> +  expanded_location curr_locus_e = {};
>int curr_discr = 0;
>
>/* Traverse the basic block, if two function calls within a basic block
> @@ -1215,7 +1214,7 @@ assign_discriminators (void)
>for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next ())
> {
>   gimple *stmt = gsi_stmt (gsi);
> - expanded_location curr_locus_e;
> +
>   if (curr_locus == UNKNOWN_LOCATION)
> {
>   curr_locus = gimple_location (stmt);
> @@ -1238,6 +1237,8 @@ assign_discriminators (void)
> curr_discr = next_discriminator_for_locus (curr_locus);
> }
>
> +  gimple *last = last_stmt (bb);
> +  location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
>if (locus == UNKNOWN_LOCATION)
> continue;
>
> --
> 2.25.1
>

It restored bootstrap for me.

Thanks.

-- 
H.J.


[PATCH][ICE] Fix for PR107193.

2022-10-10 Thread Eugene Rozenfeld via Gcc-patches
The bug was introduced in f30e9fd33e56a5a721346ea6140722e1b193db42.
A variable (cur_locus_e) was incorrectly declared inside a loop.
I also moved two other declarations (last and locus) down to make
the code more clear.

Tested on x86_64-pc-linux-gnu.

gcc/ChangeLog:
PR debug/107193
* tree-cfg.cc (assign_discriminators): Move declaration of cur_locus_e
out of the loop.
---
 gcc/tree-cfg.cc | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index 41f2925665f..ae781871a19 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -1204,9 +1204,8 @@ assign_discriminators (void)
   edge e;
   edge_iterator ei;
   gimple_stmt_iterator gsi;
-  gimple *last = last_stmt (bb);
-  location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
   location_t curr_locus = UNKNOWN_LOCATION;
+  expanded_location curr_locus_e = {};
   int curr_discr = 0;
 
   /* Traverse the basic block, if two function calls within a basic block
@@ -1215,7 +1214,7 @@ assign_discriminators (void)
   for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next ())
{
  gimple *stmt = gsi_stmt (gsi);
- expanded_location curr_locus_e;
+
  if (curr_locus == UNKNOWN_LOCATION)
{
  curr_locus = gimple_location (stmt);
@@ -1238,6 +1237,8 @@ assign_discriminators (void)
curr_discr = next_discriminator_for_locus (curr_locus);
}
 
+  gimple *last = last_stmt (bb);
+  location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
   if (locus == UNKNOWN_LOCATION)
continue;
 
-- 
2.25.1