public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Tentative patch to catch a[n]=b[n++]...
@ 1998-03-26 21:49 Kaz Kylheku
  1998-03-29  5:14 ` Jeffrey A Law
  0 siblings, 1 reply; 8+ messages in thread
From: Kaz Kylheku @ 1998-03-26 21:49 UTC (permalink / raw)
  To: 'Jim Wilson', Michael Meeks; +Cc: egcs

On Wednesday, March 25, 1998 1:04 PM, Jim Wilson [SMTP:wilson@cygnus.com] 
wrote:
> 	I have written a patch for gcc-2.8.1 / egcs-1.0.2 that flags
> 	warnings on the more simple cases of modifying a variable between sequence
> 	points.
>
> It would be interesting to have such a warning option in gcc.

Interesting, but probably not useful. Only boneheaded programmers write the
simple cases; and the not-so-simple cases are difficult to detect.
I would find it a waste of compile time for my own code, and annoying
if it warns on correct code.

Perhaps a run-time diagnosis based on the bounds checking code would
be more fruitful, in that it would actually detect when a modification has
happened to the same object more than once in arbitrarily complex
cases.


^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: Tentative patch to catch a[n]=b[n++]...
@ 1998-04-27 11:10 Kaz Kylheku
  0 siblings, 0 replies; 8+ messages in thread
From: Kaz Kylheku @ 1998-04-27 11:10 UTC (permalink / raw)
  To: 'Michael Meeks'; +Cc: 'egcs@cygnus.com'

On Saturday, April 25, 1998 2:10 PM, Michael Meeks 
[SMTP:michael@imaginator.com] wrote:
>
> Hi,
>
> 	I have written a patch for gcc-2.8.1 / egcs-1.0.2 that flags
> warnings on the more simple cases of modifying a variable between sequence
> points.

However, the example given in your Subject: line isn't a case of modifying
a variable more than once between sequence points.

It is a violation of the second law: the value of a modified object shall be 
accessed
only for the purpose of computing the new value.

Suppose that a[] and b[] do not overlap. What is wrong with a[n] = b[n++]?
Clearly, no object is modified more than once. But the prior value of 'n' is
used in a subexpression which is not subordinate to the computation
of the new value, namely the subexpression which supplies the offset
into a[]. This use of n does not demonstrably precede its modification,
so it is ambiguous whether the prior value or the new value is used---or
even whether indeed some half-baked value is used. The behavior is
undefined.

I hate to ask this, but are you sure you know what you are doing? :) :)


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Tentative patch to catch a[n]=b[n++]...
@ 1998-04-25 17:40 Michael Meeks
  1998-05-06 23:49 ` Jeffrey A Law
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Meeks @ 1998-04-25 17:40 UTC (permalink / raw)
  To: egcs

Hi,

	I have written a patch for gcc-2.8.1 / egcs-1.0.2 that flags
warnings on the more simple cases of modifying a variable between sequence
points.

	Since the code doesn't locate sequence points in a formal manner,
it will warn on some code that is correct but unadvisable :-) Here is a
list of results on my test code:

  a = ++a + b ; /* Fail */
  a = a-- + b ; /* Fail */
  a = (a++ && 4) ; /* shouldn't Fail but does */

  a[n]=b[n++] ; /* Fail */
  a[--n]=b[n] ; /* Fail */
  a[++n]=b[--n] ; /* Fail */
  c[n][n]=c[n][n]++ ; /* should fail but doesn't */
  c[n][p]=c[n][n++] ; /* Fail */ /* if lvalue [n][n] then fails twice */

  *ptr++ = (int)ptr++ ; /* Fail */
  ptr->a = ptr->a++ ; /* should fail but doesn't */
  ptr->a = (int)(ptr++) ; /* Fail */

a = b = a++ ;   /* Fail */
b = a = --b ;   /* Fail */
a = 1 + (a=1) ; /* Fail */
a = (a=b) ;     /* Fail */
a = (a=b) + 1 ; /* Fail */

	These cases are just hacked from my regression test code, does
this look like something that is sufficiently useful to include ? What
worries me is wrongly flagging correct cases. There are always cases that
are not possible to trap eg. 

int a ;
int *b = &a, *c = &a ;
*b = *c++ ;

	etc.

	As I haven't grasped the process of Changelog entries / posting
patches etc. can someone help ?

	Thanks for your time,

		Michael Meeks.

-- 
 michael@imaginator.com  <><, Pseudo Engineer, itinerant idiot




^ permalink raw reply	[flat|nested] 8+ messages in thread
* egcs-1.0.2 release
@ 1998-03-18 14:08 Jeffrey A Law
  1998-03-19 21:47 ` Tentative patch to catch a[n]=b[n++] Michael Meeks
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey A Law @ 1998-03-18 14:08 UTC (permalink / raw)
  To: egcs-announce, gnu-gcc-announce, compilers; +Cc: egcs, gcc2

                                 egcs-1.0.2
                                      
   March 16, 1998
   
   We are pleased to announce the release of egcs-1.0.2.
   
   egcs is a collaborative effort involving several groups of hackers
   using an open development model to accelerate development and testing
   of GNU compilers and runtime libraries.
   
   egcs-1.0.2 is a minor update to the egcs-1.0.1 compiler to fix several
   serious problems in egcs-1.0.1.
     * General improvements and fixes
          + Memory comsumption significantly reduced, especially for
            templates and inline functions.
          + Fix various problems with glibc2.1.
          + Fix loop optimization bug exposed by rs6000/ppc port.
          + Fix to avoid potential code generation problems in jump.c.
          + Fix some undefined symbol problems in dwarf1 debug support.
     * g++/libstdc++ improvements and fixes
          + libstdc++ in the egcs release has been updated and should be
            link compatible with libstdc++-2.8.
          + Various fixes in libio/libstdc++ to work better on Linux
            systems.
          + Fix problems with duplicate symbols on systems that do not
            support weak symbols.
          + Memory corruption bug and undefined symbols in bastring have
            been fixed.
          + Various exception handling fixes.
          + Fix compiler abort for very long thunk names.
     * g77 improvements and fixes
          + Fix compiler crash for omitted bound in Fortran CASE
            statement.
          + Add missing entries to g77 lang-options.
          + Fix problem with -fpedantic in the g77 compiler.
          + Fix "backspace" problem with g77 on alphas.
          + Fix x86 backend problem with Fortran literals and -fpic.
          + Fix some of the problems with negative subscripts for g77 on
            alphas.
          + Fixes for Fortran builds on cygwin32/mingw32.
     * platform specific improvements and fixes
          + Fix long double problems on x86 (exposed by glibc)
          + x86 ports define i386 again to keep imake happy.
          + Fix exception handling support on NetBSD ports.
          + Several changes to collect2 to fix many problems with AIX.
          + Define __ELF__ for rs6000/linux.
          + Fix -mcall-linux problem on rs6000/linux.
          + Fix stdarg/vararg problem for rs6000/linux.
          + Allow autoconf to select a proper install problem on AIX 3.1.
          + m68k port support includes -mcpu32 option as well as cpu32
            multilibs.
          + Fix stdarg bug for irix6.
          + Allow egcs to build on irix5 without the gnu assembler.
          + Fix problem with static linking on sco5.
          + Fix bootstrap on sco5 with native compiler.
          + Fix for abort building newlib on H8 target.
          + Fix fixincludes handling of math.h on SunOS.
          + Minor fix for motorola 3300 m68k systems.
       
   An important goal of egcs is to allow wide scale testing of new
   features and optimizations which are still under development. However,
   egcs has been carefully tested and should be comparable in quality to
   most gcc releases.
   
   egcs-1.0.2 is based on an August 2, 1997 snapshot of the gcc-2.8
   development sources; it contains nearly all of the new features found
   in gcc-2.8.
   
   egcs also contains many improvements and features not found in gcc-2.7
   or gcc-2.8.
     * Integrated C++ runtime libraries, including support for most major
       linux systems!
     * The integrated libstdc++ library includes a verbatim copy of
       [1]SGI's STL release.
     * Integrated GNU Fortran compiler
     * New instruction scheduler
     * New alias analysis code
       
   See the [2]new features page for a more complete list of new features
   found in egcs-1.0.x releases.
   
   The egcs-1.0.2 release includes installation instructions in both HTML
   and plaintext forms (see the INSTALL directory in the toplevel
   directory of the egcs-1.0.2 distribution). However, we also keep the
   most up to date [3]installation instructions and [4]build/test status
   on our web page. We will update those pages as new information becomes
   available.
   
   And, we can't in good conscience fail to mention some [5]caveats to
   using egcs.
   
   Update: Big thanks to Stanford for providing a high speed link for
   downloading egcs (go.cygnus.com)!
   
   [6]Download egcs-1.0.2 from ftp.cygnus.com (USA California)
   
   [7]Download egcs-1.0.2 from go.cygnus.com (USA California -- High
   speed link provided by Stanford)
   
   [8]Download egcs-1.0.2 from cambridge.cygnus.com (USA Massachusetts)
   
   The egcs-1.0.2 release is also available on many mirror sites.
   [9]Goto mirror list to find a closer site
   
   We'd like to thank the numerous people that have contributed new
   features, test results, bugfixes, etc. Unfortunately, they're far too
   numerous to mention by name.
     _________________________________________________________________
                                      
   Last modified on March 15, 1998.

References

   1. http://www.sgi.com/Technology/STL
   2. http://egcs.cygnus.com/features.html
   3. http://egcs.cygnus.com/install/index.html
   4. http://egcs.cygnus.com/buildstat.html
   5. http://egcs.cygnus.com/caveats.html
   6. ftp://egcs.cygnus.com/pub/egcs/releases/index.html
   7. ftp://go.cygnus.com/pub/ftp.cygnus.com/egcs/releases/index.html
   8. ftp://cambridge.cygnus.com/pub/egcs/releases/index.html
   9. http://egcs.cygnus.com/index.html#mirrors

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

end of thread, other threads:[~1998-05-06 23:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-26 21:49 Tentative patch to catch a[n]=b[n++] Kaz Kylheku
1998-03-29  5:14 ` Jeffrey A Law
1998-04-02 11:32   ` Joe Buck
  -- strict thread matches above, loose matches on Subject: below --
1998-04-27 11:10 Kaz Kylheku
1998-04-25 17:40 Michael Meeks
1998-05-06 23:49 ` Jeffrey A Law
1998-03-18 14:08 egcs-1.0.2 release Jeffrey A Law
1998-03-19 21:47 ` Tentative patch to catch a[n]=b[n++] Michael Meeks
1998-03-25 14:00   ` Jim Wilson

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