- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- -Onovolatile behavior
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2009 10:18 AM
11-20-2009 10:18 AM
I have a question about the aCC 3.85 compiler option -Onovolatile.
Does this compiler option trump any explicit volatile declarations in the source code?
Thank you for your help,
David Ritter
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2009 10:45 AM
11-20-2009 10:45 AM
Re: -Onovolatile behavior
Perhaps this helps:
http://docs.hp.com/en/14487/options.htm#opt+Onovolatile
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2009 10:57 AM
11-20-2009 10:57 AM
Re: -Onovolatile behavior
My project is using the volatile keyword, but in an optimized build the compiler seems to not be respecting it unless I explicitly tell the compiler -Ovolatile.
Here is a simple test case:
// begin file
void func( volatile int& foo ) {
while(foo < 1000) {}
}
// end file
compiling without -Ovolatile the compiler will emit the following warning:
Infinite loop detected. Check for spinning on non-volatile variable.
As noted, if I add -Ovolatile the warning goes away.
Additionally I looked over the assembly code generated by the compiler and it appears that in the optimized build the volatile keyword is being stripped out and not respected.
That is the source of my confusion. I can't tell if this is a compiler bug or if I am doing something wrong.
Thanks!
David Ritter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2009 11:28 AM
11-20-2009 11:28 AM
Re: -Onovolatile behavior
Additionally the documentation you linked to was for aCC 6.20, which I understand to be for HP Itantium. I am using aCC 3.85 on PA-RISC.
I have access to the aCC 6.23 compiler and that compiler notes that -Ovolatile is not a supported compiler option.
Thank you again for any additional insights.
David Ritter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2009 09:37 AM - edited 08-27-2011 04:53 AM
11-21-2009 09:37 AM - edited 08-27-2011 04:53 AM
Solution>Does this compiler option trump any explicit volatile declarations in the source code?
No. You should not be using this option nor +Ovolatile, use the keywords. These are deprecated in aCC6.
>My project is using the volatile keyword, but in an optimized build the compiler seems to not be respecting it unless I explicitly tell the compiler +Ovolatile.
>compiling without +Ovolatile the compiler will emit the following warning:
Yes, that shows the problem.
>I can't tell if this is a compiler bug
It looks like one. Try using a pointer instead of a reference:
volatile int *foo_p = &foo:
while (*foo_p < 100)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2009 07:49 AM
11-23-2009 07:49 AM
Re: -Onovolatile behavior
Your workaround of using an int pointer does address the compiler warning. I will apply this workaround to our code base. I much prefer this to the sledgehammer of the compiler option, especially since the message I am hearing from both of you is that +Ovolatile is not ever recommended.
Thanks,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2009 08:35 AM - edited 08-27-2011 04:54 AM
11-23-2009 08:35 AM - edited 08-27-2011 04:54 AM
Re: +Onovolatile behavior
Have you contacted the Response Center yet to report the problem?
>since the message I am hearing from both of you
You mean me and me? (Since I removed the option. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2009 08:49 AM
11-23-2009 08:49 AM
Re: -Onovolatile behavior
I have been unable to find our Response Center login information so far to file an issue.
Thanks,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2009 09:31 AM - edited 08-27-2011 04:56 AM
11-23-2009 09:31 AM - edited 08-27-2011 04:56 AM
Re: +Onovolatile behavior
>I meant you and James.
And I meant that James was pointing to info I had added. And now I have removed the option for Integrity.
Aug 2011: And removed in A.06.26.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2009 09:12 PM - edited 08-27-2011 04:55 AM
11-23-2009 09:12 PM - edited 08-27-2011 04:55 AM
Re: +Onovolatile behavior
I can duplicate the problem. It seems references to volatile fail, pointers work.
Using +O3 also fixes it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2009 11:14 AM
11-24-2009 11:14 AM
Re: -Onovolatile behavior
Thank you for your help regarding this Dennis.
David Ritter