bug-mes
[Top][All Lists]
Advanced

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

Re: [bug-mes] MesCC neglects alignment requirements of the System V ABI


From: Mark H Weaver
Subject: Re: [bug-mes] MesCC neglects alignment requirements of the System V ABI
Date: Thu, 18 Jul 2019 17:47:46 -0400

Hi Danny,

Danny wrote:
> It would not be practically possible to review something that does everything
> that POSIX, the ABI and the C standard requires (that would likely end up
> being just as large as gcc, right?).

Most of GCC's complexity is related its optimization passes, so I
heartily disagree that any conforming compiler would likely end up as
large as GCC.

> Therefore, we cut corners where safe.

How do you know that it's safe, and more importantly, how can you
convince other people (such as me) of this assertion?

Considered in isolation, I agree that keeping MesCC as simple as
possible is a worthy goal.  However, it seems that you are now asking me
to take on faith that the corners you've cut will not cause the compiled
programs to misbehave.  Avoiding faith would apparently require me to
read the source code compiled by MesCC to convince myself that these
trimmed corners will not cause problems.  And even if I did what, what
happens when those later programs are updated?

IMO, you're optimizing the wrong thing.  Understanding what this
compiler does is of little comfort to me when I can plainly see within a
few minutes of inspection that it does not correctly implement even the
most basic semantics of C.

I think what you should be optimizing is the ease with which I can
convince myself that the programs compiled by MesCC behave correctly.

>>, unless you compile every word access as a set of byte
>>> accesses and use arithmetic to put those bytes together into a word.
>
> No.

Suppose I have the following struct:

  struct { char a; int b; } st;

If I understand correctly the code correctly, the offset of 'b' will be
1 byte into the structure.  Is that right?  If so, how does MesCC
compile an access to st.b?

      Regards,
        Mark



reply via email to

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