🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #510

Re: No Aliasing Compile Option

#510
From: Mark ROBERTS
Date: Fri, 25 May 1990 17:48
35 lines
2266 bytes
In article <1913@cod.NOSC.MIL> bmarsh@cod.nosc.mil.UUCP (William C. Marsh)
writes:

>Example of a misuse of aliasing:
>
>int	test = 0, *int_ptr;
>int_ptr = &test;
>do {
>	*int_ptr = 1;
>} while (test == 0);
>
>This is a very simple example, but it represents the only area where MSC
>generated incorrect code in my 2.5 years using 5.X.  In my opinion, this 
>style of codeing is very bad, as it is very easy to forget that "*int_ptr"
>and "test" are the same thing (Well, not in *this* example ;-)

The detection of common aliasing practices has been improved in the
Microsoft C version 6.00 code generator. The primary difference is
that the compiler now tries to detect when the address of a variable
has been taken and then protect against aliasing corruption of that
variable even when the /Oa option is selected. If no option's are
selected that invoke the global optimizer, i.e. (/Oe, /Og, /Ol), the
optimizer depends on the preproccessor marking all variables that
have had their address taken (&). With global optimization the
optimizer itself does the necessary data flow analysis to determine
if an address has been taken. This makes /Oa safer when used in
conjunction with global optimization since it can detect addresses
being taken even in the absence of the address-of operator (&).

>I have three or four (four counting a graphics library) commercial software
>packages completed, *ALL* using -0a!

The C6 compiler is also compiled -Oxa, except for two functions where
it was more convenient to use #pragma optimize to turn off -Oa, rather 
than rewrite the code to remove the aliasing.
Technical Details
Message-ID: <54868@microsoft.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!microsoft!markro
References: <4886@daffy.cs.wisc.edu> <26547195.F69@tct.uucp> <1990May19.141401.4350@ux1.cso.uiuc.edu> <265861D7.3293@tct.uucp> <1913@cod.NOSC.MIL>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!microsoft!markro
From: markro@microsoft.UUCP (Mark ROBERTS)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: No Aliasing Compile Option
Summary: Behavior of /Oa and /Ow Safer in C6.00
Keywords: aliasing
Message-ID: <54868@microsoft.UUCP>
Date: 25 May 90 17:48:54 GMT
References: <4886@daffy.cs.wisc.edu> <26547195.F69@tct.uucp> <1990May19.141401.4350@ux1.cso.uiuc.edu> <265861D7.3293@tct.uucp> <1913@cod.NOSC.MIL>
Reply-To: markro@microsoft.UUCP (Mark ROBERTS)
Organization: Microsoft Corp., Redmond WA
Lines: 35