Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives Mailing Lists Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old July 6th, 2008, 11:20 AM
Eric Botcazou
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Ping: Switch initializations conversion

+ info.index_expr = SWITCH_CND (swtch);
+ index_type = TREE_TYPE (info.index_expr);

The use of the SWITCH_CND's type as the index type is problematic in Ada (and
maybe in other languages) because it badly interacts with the optimization in
tree-ssa-forwprop.c that gobbles casts within SWITCH_CND and you may end up
doing arithmetics in the wrong type.

Ada testcase attached, compile with "gcc -c p.adb".

+ BUG
| 4.4.0 20080704 (experimental) [trunk revision 137450] (i586-suse-linux-gnu)
GCC error:|
| in set_value_range, at tree-vrp.c:379 |
| Error detected around p.adb:12

In .028t.ccp:

op_kind.0_7 = (q__internal_element_kinds) op_kind_2(D);
switch (op_kind.0_7)
{
case 244: goto <L4>;
case 246: goto <L3>;
default : goto <L5>;
}

op_kind is , which is an
subtype (you cannot do arithmetics in it), so it is converted to the base
type q__internal_element_kinds before the switch.

In 029t.forwprop1 the conversion is removed:

op_kind.0_7 = (q__internal_element_kinds) op_kind_2(D);
switch (op_kind_2(D))
{
case 244: goto <L4>;
case 246: goto <L3>;
default : goto <L5>;
}

Then in 040t.switchconv arithmetics in the subtype is created:

csui.6_8 = op_kind_2(D);
csui.6_7 = csui.6_8 - 244;
if (csui.6_7 <= 2)
goto <bb 10(<L10>);
else
goto <bb 9(<L9>);

which doesn't make sense since the range of the subtype in [226; 246] and
ultimately leads to the VRP failure because it deduces the [226;2] range
for the first branch of the condition.


It seems to me that, since the pass generates new arithmetics for the
SWITCH_EXPR, it should do it in the SWITCH_EXPR's type and the condition be
converted back to it if necessary. What do you think? Thanks in advance.

--
Eric Botcazou

Reply With Quote
Reply

Viewing: Web Development Archives Mailing Lists Development > Ping: Switch initializations conversion


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT