public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [IRA] Segfault in ira_costs.c:find_costs_and_classes for AVR target
@ 2013-12-26  9:41 Senthil Kumar Selvaraj
  2014-01-13 11:26 ` [Ping, IRA] " Senthil Kumar Selvaraj
  2014-01-14 19:14 ` [IRA] " Vladimir Makarov
  0 siblings, 2 replies; 4+ messages in thread
From: Senthil Kumar Selvaraj @ 2013-12-26  9:41 UTC (permalink / raw)
  To: gcc; +Cc: vmakarov

Hi,

  gcc.c-torture/compile/pr34856.c and a couple of other tests segfault 
  for the AVR target. Looking at the code, I found that the
  x_ira_register_move_cost array[TImode] is NULL, while the code goes on
  to dereference it (ira_register_move_cost
  [ALLOCNO_MODE (a)][best][aclass] at line 1832).

  I looked at the code that populates the array, and found that it does
  explicitly allow the array to have NULL entries for certain modes,
  atleast during initialization.

  I'm not really sure how this should be fixed - is NULL valid or is the
  AVR target violating some invariant?

Regards
Senthil
  
  

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

* [Ping, IRA] Segfault in ira_costs.c:find_costs_and_classes for AVR target
  2013-12-26  9:41 [IRA] Segfault in ira_costs.c:find_costs_and_classes for AVR target Senthil Kumar Selvaraj
@ 2014-01-13 11:26 ` Senthil Kumar Selvaraj
  2014-01-14 19:10   ` Vladimir Makarov
  2014-01-14 19:14 ` [IRA] " Vladimir Makarov
  1 sibling, 1 reply; 4+ messages in thread
From: Senthil Kumar Selvaraj @ 2014-01-13 11:26 UTC (permalink / raw)
  To: gcc; +Cc: vmakarov

Ping !

Regards
Senthil

On Thu, Dec 26, 2013 at 03:11:25PM +0530, Senthil Kumar Selvaraj wrote:
> Hi,
> 
>   gcc.c-torture/compile/pr34856.c and a couple of other tests segfault 
>   for the AVR target. Looking at the code, I found that the
>   x_ira_register_move_cost array[TImode] is NULL, while the code goes on
>   to dereference it (ira_register_move_cost
>   [ALLOCNO_MODE (a)][best][aclass] at line 1832).
> 
>   I looked at the code that populates the array, and found that it does
>   explicitly allow the array to have NULL entries for certain modes,
>   atleast during initialization.
> 
>   I'm not really sure how this should be fixed - is NULL valid or is the
>   AVR target violating some invariant?
> 
> Regards
> Senthil
>   
>   
> 

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

* Re: [Ping, IRA] Segfault in ira_costs.c:find_costs_and_classes for AVR target
  2014-01-13 11:26 ` [Ping, IRA] " Senthil Kumar Selvaraj
@ 2014-01-14 19:10   ` Vladimir Makarov
  0 siblings, 0 replies; 4+ messages in thread
From: Vladimir Makarov @ 2014-01-14 19:10 UTC (permalink / raw)
  To: Senthil Kumar Selvaraj, gcc

On 01/13/2014 03:54 AM, Senthil Kumar Selvaraj wrote:
> Ping !
>
> Regards
> Senthil
>
> On Thu, Dec 26, 2013 at 03:11:25PM +0530, Senthil Kumar Selvaraj wrote:
>> Hi,
>>
>>   gcc.c-torture/compile/pr34856.c and a couple of other tests segfault 
>>   for the AVR target. Looking at the code, I found that the
>>   x_ira_register_move_cost array[TImode] is NULL, while the code goes on
>>   to dereference it (ira_register_move_cost
>>   [ALLOCNO_MODE (a)][best][aclass] at line 1832).
>>
>>   I looked at the code that populates the array, and found that it does
>>   explicitly allow the array to have NULL entries for certain modes,
>>   atleast during initialization.
>>
>>   I'm not really sure how this should be fixed - is NULL valid or is the
>>   AVR target violating some invariant?
>>
>> Regards
>> Senthil
>>   
>>   
>>
Sorry for the delay with the answer.  NULL is not valid.  IRA calculates
many internal data structures.  So some people implemented a lazy
approach in such data structure calculation (NULL means that the data
were not calculated yet).  Probably, one place was missed or added
lately without checking that data were calculated.

I'll look at this and fix the problem this week.

Thanks for pointing this out, Senthil.

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

* Re: [IRA] Segfault in ira_costs.c:find_costs_and_classes for AVR target
  2013-12-26  9:41 [IRA] Segfault in ira_costs.c:find_costs_and_classes for AVR target Senthil Kumar Selvaraj
  2014-01-13 11:26 ` [Ping, IRA] " Senthil Kumar Selvaraj
@ 2014-01-14 19:14 ` Vladimir Makarov
  1 sibling, 0 replies; 4+ messages in thread
From: Vladimir Makarov @ 2014-01-14 19:14 UTC (permalink / raw)
  To: Senthil Kumar Selvaraj, gcc

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

On 12/26/2013 04:41 AM, Senthil Kumar Selvaraj wrote:
> Hi,
>
>   gcc.c-torture/compile/pr34856.c and a couple of other tests segfault 
>   for the AVR target. Looking at the code, I found that the
>   x_ira_register_move_cost array[TImode] is NULL, while the code goes on
>   to dereference it (ira_register_move_cost
>   [ALLOCNO_MODE (a)][best][aclass] at line 1832).
>
>   I looked at the code that populates the array, and found that it does
>   explicitly allow the array to have NULL entries for certain modes,
>   atleast during initialization.
>
>   I'm not really sure how this should be fixed - is NULL valid or is the
>   AVR target violating some invariant?
>
The following patch fixes the problem.

Committed as rev. 206606.

2014-01-14  Vladimir Makarov  <vmakarov@redhat.com>

        * ira-costs.c (find_costs_and_classes): Add missed
        ira_init_register_move_cost_if_necessary.



[-- Attachment #2: z --]
[-- Type: text/plain, Size: 497 bytes --]

Index: ira-costs.c
===================================================================
--- ira-costs.c	(revision 206579)
+++ ira-costs.c	(working copy)
@@ -1827,6 +1827,7 @@ find_costs_and_classes (FILE *dump_file)
 		  int ind = cost_classes_ptr->index[aclass];
 
 		  ira_assert (ind >= 0);
+		  ira_init_register_move_cost_if_necessary (ALLOCNO_MODE (a));
 		  ira_add_allocno_pref (a, ira_class_hard_regs[best][0],
 					(a_costs[ind] - ALLOCNO_CLASS_COST (a))
 					/ (ira_register_move_cost

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

end of thread, other threads:[~2014-01-14 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-26  9:41 [IRA] Segfault in ira_costs.c:find_costs_and_classes for AVR target Senthil Kumar Selvaraj
2014-01-13 11:26 ` [Ping, IRA] " Senthil Kumar Selvaraj
2014-01-14 19:10   ` Vladimir Makarov
2014-01-14 19:14 ` [IRA] " Vladimir Makarov

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