lkml.org 
[lkml]   [1998]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: Linux 2.0.3x & gcc 2.8 [better use egcs for now]
    From
    Date
    wmglo@dent.med.uni-muenchen.de (Wolfram Gloger) writes:

    > I just checked this code:
    >
    > int f(long e)
    > {
    > *(&e) = e & 0x1234;
    > return 0;
    > }
    >
    > and found that egcs-1.0.1 _never_ optimizes the assignment away (no
    > volatile is needed). So, people should maybe use that rather than
    > gcc-2.8.0 for compiling 2.0.x.

    That is because egcs 1.0.1 doesn't contain the addressof optimization.
    Post 1.0.1-release versions of egcs have merged that code from 2.8.0.

    >
    > > Kenner admited that it was a bug in the new addressof optimization (which
    > > finally supports *(&x) = y) and promised a fix for 2.8.1.
    >
    > IMHO, a single assignment to *(&x) can _never_ be optimized away
    > (multiple such assignments could be folded into one possibly). I
    > can't see why a volatile specification or cast should make a
    > difference either, since the variable isn't written to by another
    > context of execution.

    It can be optimized away when x is dead and there are no aliases - and it is
    certainly dead when it is the last operation on a local variable or an argument.

    For threads you need to use volatile variables.


    -Andi

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu

    \
     
     \ /
      Last update: 2005-03-22 13:41    [W:0.032 / U:0.104 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site