diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-08-19 10:19:11 +0200 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-08-19 10:19:11 +0200 |
commit | 98427e8d2e51b1b7590bbde3fc18c49ff7dd8e13 (patch) | |
tree | 4788e5c92252dea1767da7e31611fc0a1404822e | |
parent | f26267c6289e4fa306a0875ff149a00ee401e043 (diff) | |
download | compcert-98427e8d2e51b1b7590bbde3fc18c49ff7dd8e13.tar.gz compcert-98427e8d2e51b1b7590bbde3fc18c49ff7dd8e13.zip |
Exit earlier on invalid alignof and sizeof.
Alginof and sizeof applied to incomplete types now exit earlier
with a fatal error.
Bug 19594.
-rw-r--r-- | cparser/Elab.ml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 2b5b4591..973dfb30 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -1484,7 +1484,7 @@ let elab_expr loc env a = | EXPR_SIZEOF a1 -> let b1,env = elab env a1 in if wrap incomplete_type loc env b1.etyp then - err "incomplete type %a" Cprint.typ b1.etyp; + error "incomplete type %a" Cprint.typ b1.etyp; let bdesc = (* Catch special cases sizeof("string literal") *) match b1.edesc with @@ -1501,19 +1501,19 @@ let elab_expr loc env a = | TYPE_SIZEOF (spec, dcl) -> let (ty, env') = elab_type loc env spec dcl in if wrap incomplete_type loc env' ty then - err "incomplete type %a" Cprint.typ ty; + error "incomplete type %a" Cprint.typ ty; { edesc = ESizeof ty; etyp = TInt(size_t_ikind(), []) },env' | EXPR_ALIGNOF a1 -> let b1,env = elab env a1 in if wrap incomplete_type loc env b1.etyp then - err "incomplete type %a" Cprint.typ b1.etyp; + error "incomplete type %a" Cprint.typ b1.etyp; { edesc = EAlignof b1.etyp; etyp = TInt(size_t_ikind(), []) },env | TYPE_ALIGNOF (spec, dcl) -> let (ty, env') = elab_type loc env spec dcl in if wrap incomplete_type loc env' ty then - err "incomplete type %a" Cprint.typ ty; + error "incomplete type %a" Cprint.typ ty; { edesc = EAlignof ty; etyp = TInt(size_t_ikind(), []) },env | UNARY(PLUS, a1) -> |