mewmew/uc

sematinc: Implement checks for assignment only to lvalue equivalent type

sangisos opened this issue · 6 comments

from test file incorrect/semantic/se25.c:

/* Test file for semantic errors. Contains exactly one error. */

int main (void) {
  (1 + 2) = 3; //No assignment here!
}

Check assignments for lvalue equivalent type, preferably in a future proof manner.
In the future, support for array names and dereferenced pointer expressions to be assigned to will be added.

This should perhaps be done before before type checking, as the error messages will make more sense for files like incorrect/semantic/se11.c:

/* Test file for semantic errors. Contains exactly one error. */

int a(void) {
  a = 1;    // 'a' is not an lval
  return 0;
}

int main(void) {
 a();
}

now giving error message:
invalid operation: a = 1 (type mismatch between "int(void)" and "int")

Request for comment @mewmew

An initial implementation of isAssignment was added in commit 4120fc5.

Would be happy to discuss this issue in greater detail next time we meet, as it is a non-trivial one.

Ok, lets have a meeting tomorrow about these decisions.

Ok, lets have a meeting tomorrow about these decisions.

Wonderful. Meet up at around 14dk?

Sure, sounds good.

Med Vänliga Hälsningar
Alexander Andersson
On 29 Apr 2016 02:09, "Robin Eklind" notifications@github.com wrote:

Ok, lets have a meeting tomorrow about these decisions.

Wonderful. Meet up at around 14dk?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#55 (comment)

Closing for now. Re-opened in the future to discuss specific issues with the current implementation, or to further validate the implementation against the C specification.