bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Bug-tar] x86/Solaris test failure (25, 28)


From: Matthew Woehlke
Subject: RE: [Bug-tar] x86/Solaris test failure (25, 28)
Date: Thu, 08 Mar 2007 20:09:39 -0000

Joerg Schilling wrote:
> Matthew Woehlke wrote:
> > First, a build failure: I had to change src/xheader.c:1097:
> >
> > -  const struct timespec mtime = data ? *(struct timespec *) data :
st->mtime;
> > +  const struct timespec mtime = data ? *(const struct timespec *)
data : st->mtime;
> >
> > (seems like a pedantic compiler thing, but...)
> 
> Not a pedantic compiler buit a compiler that honors "const".
> Unfortunately, GCC mostly ignores const.

If this was assigning a pointer, that would make sense, but that isn't
what is happening. This is assigning the value of a non-const struct to
a const struct, which should be a copy operation, shouldn't it?

Oddly enough, this succeeds:

====
struct bar {
    int x,y;
};

int main() {
    struct bar a = { 2, 5 };
    const struct bar b = a.y ? *(struct bar*)(&a) : a;
    return b.y;
}
====

...so I don't actually know why this failed in the first place.

Anyway, it isn't important. :-)

-- 
Matthew




reply via email to

[Prev in Thread] Current Thread [Next in Thread]