Article View: gnu.gcc.bug
Article #6359Re: [andy@hyperparallel.com: Re: Apparent problem with Ghostscript 3.60 and gcc 2.7.x]
From: Rusty, Paul , Russell
Date: Mon, 04 Dec 1995 00:00
Date: Mon, 04 Dec 1995 00:00
40 lines
2175 bytes
2175 bytes
In message <m0tMfIe-0000c9C@aladdin.com> L. Peter Deutsch wrote: > Here is a simple bug that occurs with gcc 2.7.1 and 2.7.2 on many different > architectures, reported by 3 different users. I don't have this version of > gcc readily available to me, so please reply to one of the users in the 'cc' > list. > > A subsequent e-mail states that the compiler produces correctly working > output if the 'const' is deleted from the cast. [ Code example of using pointer to const to point to obviously non-const deleted ] > Under 2.7.x, gcc views the pointer dereference in the "if" statement > as a constant, which is happily evaluates once, outside the loop. I'm afraid that this is not a bug in gcc; it is a bug in your program that gcc has uncovered; it is using the fact claim that this is a const pointer to justify moving the test outside the loop; this is a good thing. It seems likely that the only reason for the convoluted `*(const char *)&x' construct is to prompt compilers towards exactly such optimising behaviour. Perhaps this assumption of const was valid in a previous version of your code; it clearly no longer is. > It appears that I will have to put a patch into the next Ghostscript release > to make it not use 'const' if it is being compiled with these versions of > gcc. Why not just replace the construct with "x", and thus fix your (broken) code? Am I missing something here? Rusty. -- Rusty.Russell@adelaide.maptek.com.au "Engineer? So you drive trains?" Lies, damned lies, and out-of-date documentation. #include <stddisclm.h>
Technical Details
Message-ID:
<199512050212.MAA12826@gauss.adelaide.maptek.com.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<m0tMfIe-0000c9C@aladdin.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,663e2e15612b617a,start X-Google-Attributes: gid113d02,public From: Rusty.Russell@adelaide.maptek.com.au (Rusty, Paul , Russell) Subject: Re: [andy@hyperparallel.com: Re: Apparent problem with Ghostscript 3.60 and gcc 2.7.x] Date: 1995/12/04 Message-ID: <199512050212.MAA12826@gauss.adelaide.maptek.com.au> X-Deja-AN: 120945671 distribution: gnu sender: daemon@cis.ohio-state.edu references: <m0tMfIe-0000c9C@aladdin.com> organization: GNUs Not Usenet newsgroups: gnu.gcc.bug