From 6554dd6f8e5b1faafbda33b853a3de08ffd0ff6e Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Sat, 28 Mar 2020 18:02:11 +0100 Subject: Add location to transform functions. --- cparser/Bitfields.ml | 8 ++++---- cparser/StructPassing.ml | 12 ++++++------ cparser/Transform.ml | 24 ++++++++++++------------ cparser/Transform.mli | 12 ++++++------ 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cparser/Bitfields.ml b/cparser/Bitfields.ml index 696a9a8d..efb82b01 100644 --- a/cparser/Bitfields.ml +++ b/cparser/Bitfields.ml @@ -189,7 +189,7 @@ let rec transf_union_members env id count = function { fld_name = carrier; fld_typ = carrier_typ; fld_bitfield = None; fld_anonymous = false;} :: transf_union_members env id (count + 1) ms) -let transf_composite env su id attr ml = +let transf_composite env loc su id attr ml = if List.for_all (fun f -> f.fld_bitfield = None) ml then (attr, ml) else begin @@ -550,7 +550,7 @@ and transf_init env i = (* Declarations *) -let transf_decl env (sto, id, ty, init_opt) = +let transf_decl env loc (sto, id, ty, init_opt) = (sto, id, ty, match init_opt with None -> None | Some i -> Some(transf_init env i)) @@ -559,12 +559,12 @@ let transf_decl env (sto, id, ty, init_opt) = let transf_stmt env s = Transform.stmt ~expr:(fun loc env ctx e -> transf_exp env ctx e) - ~decl:transf_decl + ~decl:(fun env (sto, id, ty, init_opt) -> transf_decl env s.sloc (sto, id, ty, init_opt)) env s (* Functions *) -let transf_fundef env f = +let transf_fundef env loc f = Transform.fundef transf_stmt env f (* Programs *) diff --git a/cparser/StructPassing.ml b/cparser/StructPassing.ml index 5c6454f0..222da367 100644 --- a/cparser/StructPassing.ml +++ b/cparser/StructPassing.ml @@ -424,7 +424,7 @@ and transf_init env = function (* Declarations *) -let transf_decl env (sto, id, ty, init) = +let transf_decl env loc (sto, id, ty, init) = (sto, id, transf_type env ty, match init with None -> None | Some i -> Some (transf_init env i)) @@ -494,7 +494,7 @@ let rec transf_stmt s = | Sblock sl -> {s with sdesc = Sblock(List.map transf_stmt sl)} | Sdecl d -> - {s with sdesc = Sdecl(transf_decl env d)} + {s with sdesc = Sdecl(transf_decl env s.sloc d)} | Sasm(attr, template, outputs, inputs, clob) -> {s with sdesc = Sasm(attr, template, List.map transf_asm_operand outputs, @@ -540,13 +540,13 @@ let rec transf_funparams loc env params = actions, IdentMap.add x (ereinterpret tx' y) subst) -let transf_fundef env f = +let transf_fundef env loc f = reset_temps(); let ret = transf_type env f.fd_ret in let (params, actions, subst) = transf_funparams f.fd_body.sloc env f.fd_params in let locals = - List.map (fun d -> transf_decl env (subst_decl subst d)) f.fd_locals in + List.map (fun d -> transf_decl env loc (subst_decl subst d)) f.fd_locals in let (attr1, ret1, params1, body1) = match classify_return env f.fd_ret with | Ret_scalar -> @@ -577,7 +577,7 @@ let transf_fundef env f = (* Composites *) -let transf_composite env su id attr fl = +let transf_composite env loc su id attr fl = (attr, List.map (fun f -> {f with fld_typ = transf_type env f.fld_typ}) fl) (* Entry point *) @@ -595,5 +595,5 @@ let program p = ~decl:transf_decl ~fundef:transf_fundef ~composite:transf_composite - ~typedef:(fun env id ty -> transf_type env ty) + ~typedef:(fun env loc id ty -> transf_type env ty) p diff --git a/cparser/Transform.ml b/cparser/Transform.ml index 349a3155..6774a9b6 100644 --- a/cparser/Transform.ml +++ b/cparser/Transform.ml @@ -191,12 +191,12 @@ let fundef trstmt env f = (* Generic transformation of a program *) let program - ?(decl = fun env d -> d) - ?(fundef = fun env fd -> fd) - ?(composite = fun env su id attr fl -> (attr, fl)) - ?(typedef = fun env id ty -> ty) - ?(enum = fun env id attr members -> (attr, members)) - ?(pragma = fun env s -> s) + ?(decl = fun env loc d -> d) + ?(fundef = fun env loc fd -> fd) + ?(composite = fun env loc su id attr fl -> (attr, fl)) + ?(typedef = fun env loc id ty -> ty) + ?(enum = fun env loc id attr members -> (attr, members)) + ?(pragma = fun env loc s -> s) p = let rec transf_globdecls env accu = function @@ -205,25 +205,25 @@ let program let (desc', env') = match g.gdesc with | Gdecl((sto, id, ty, init) as d) -> - (Gdecl(decl env d), Env.add_ident env id sto ty) + (Gdecl(decl env g.gloc d), Env.add_ident env id sto ty) | Gfundef f -> - (Gfundef(fundef env f), + (Gfundef(fundef env g.gloc f), Env.add_ident env f.fd_name f.fd_storage (fundef_typ f)) | Gcompositedecl(su, id, attr) -> (Gcompositedecl(su, id, attr), Env.add_composite env id (composite_info_decl su attr)) | Gcompositedef(su, id, attr, fl) -> - let (attr', fl') = composite env su id attr fl in + let (attr', fl') = composite env g.gloc su id attr fl in (Gcompositedef(su, id, attr', fl'), Env.add_composite env id (composite_info_def env su attr fl)) | Gtypedef(id, ty) -> - (Gtypedef(id, typedef env id ty), Env.add_typedef env id ty) + (Gtypedef(id, typedef env g.gloc id ty), Env.add_typedef env id ty) | Genumdef(id, attr, members) -> - let (attr', members') = enum env id attr members in + let (attr', members') = enum env g.gloc id attr members in (Genumdef(id, attr', members'), Env.add_enum env id {ei_members = members; ei_attr = attr}) | Gpragma s -> - (Gpragma(pragma env s), env) + (Gpragma(pragma env g.gloc s), env) in transf_globdecls env' ({g with gdesc = desc'} :: accu) gl diff --git a/cparser/Transform.mli b/cparser/Transform.mli index dbd8e575..220b7944 100644 --- a/cparser/Transform.mli +++ b/cparser/Transform.mli @@ -62,14 +62,14 @@ val fundef : (Env.t -> C.stmt -> C.stmt) -> Env.t -> C.fundef -> C.fundef (** Generic transformation of a program *) val program : - ?decl:(Env.t -> C.decl -> C.decl) -> - ?fundef:(Env.t -> C.fundef -> C.fundef) -> - ?composite:(Env.t -> C.struct_or_union -> + ?decl:(Env.t -> C.location -> C.decl -> C.decl) -> + ?fundef:(Env.t -> C.location -> C.fundef -> C.fundef) -> + ?composite:(Env.t -> C.location -> C.struct_or_union -> C.ident -> C.attributes -> C.field list -> C.attributes * C.field list) -> - ?typedef:(Env.t -> C.ident -> C.typ -> C.typ) -> - ?enum:(Env.t -> C.ident -> C.attributes -> C.enumerator list -> + ?typedef:(Env.t -> C.location -> C.ident -> C.typ -> C.typ) -> + ?enum:(Env.t -> C.location -> C.ident -> C.attributes -> C.enumerator list -> C.attributes * C.enumerator list) -> - ?pragma:(Env.t -> string -> string) -> + ?pragma:(Env.t -> C.location -> string -> string) -> C.program -> C.program -- cgit From 99c97f7267a803bf92011857f5edbc8597e6b8da Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Sat, 28 Mar 2020 18:04:15 +0100 Subject: Added warning for packed composite with bitfields. --- cparser/Bitfields.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cparser/Bitfields.ml b/cparser/Bitfields.ml index efb82b01..9ca40e70 100644 --- a/cparser/Bitfields.ml +++ b/cparser/Bitfields.ml @@ -193,6 +193,8 @@ let transf_composite env loc su id attr ml = if List.for_all (fun f -> f.fld_bitfield = None) ml then (attr, ml) else begin + if find_custom_attributes ["packed";"__packed__"] attr <> [] then + Diagnostics.error loc "bitfields in packed structs not allowed"; let ml' = match su with | Struct -> transf_struct_members env id 1 ml -- cgit From 202c96018bf086dd6941bc2483aec0e77d3128ad Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 30 Mar 2020 19:25:49 +0200 Subject: Check for errors after each pass. --- cparser/Parse.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cparser/Parse.ml b/cparser/Parse.ml index 29245083..d9f9aa1c 100644 --- a/cparser/Parse.ml +++ b/cparser/Parse.ml @@ -18,7 +18,14 @@ module CharSet = Set.Make(struct type t = char let compare = compare end) let transform_program t p name = - let run_pass pass flag p = if CharSet.mem flag t then pass p else p in + let run_pass pass flag p = + if CharSet.mem flag t then begin + let p = pass p in + Diagnostics.check_errors (); + p + end else + p + in let p1 = (run_pass StructPassing.program 's' (run_pass PackedStructs.program 'p' (run_pass Unblock.program 'b' -- cgit From 0a2db0269809539ccc66f8ec73637c37fbd23580 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 17 Apr 2020 17:56:23 +0200 Subject: Support for coq 8.11.1. Update configure script. --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 6bd7ed0e..ee0108ae 100755 --- a/configure +++ b/configure @@ -530,14 +530,14 @@ missingtools=false echo "Testing Coq... " | tr -d '\n' coq_ver=$(${COQBIN}coqc -v 2>/dev/null | sed -n -e 's/The Coq Proof Assistant, version \([^ ]*\).*$/\1/p') case "$coq_ver" in - 8.8.0|8.8.1|8.8.2|8.9.0|8.9.1|8.10.0|8.10.1|8.10.2|8.11.0) + 8.8.0|8.8.1|8.8.2|8.9.0|8.9.1|8.10.0|8.10.1|8.10.2|8.11.0|8.11.1) echo "version $coq_ver -- good!";; ?*) echo "version $coq_ver -- UNSUPPORTED" if $ignore_coq_version; then echo "Warning: this version of Coq is unsupported, proceed at your own risks." else - echo "Error: CompCert requires one of the following Coq versions: 8.11.0, 8.10.2, 8.10.1, 8.10.0, 8.9.1, 8.9.0, 8.8.2, 8.8.1, 8.8.0" + echo "Error: CompCert requires one of the following Coq versions: 8.11.1, 8.11.0, 8.10.2, 8.10.1, 8.10.0, 8.9.1, 8.9.0, 8.8.2, 8.8.1, 8.8.0" missingtools=true fi;; "") -- cgit From 438d541dbe5fe7d7fe6b7aacaa6e6ef070c2e237 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 16 Apr 2020 20:23:35 +0200 Subject: Move reserved_registers to CPragmas. The list of reserved_registers is never reset between the compilation of multiple files. Instead of storing them in IRC they are moved in the CPragmas file and reset in the a new reset function for Cpragmas whic is called per file. --- backend/IRC.ml | 4 +--- backend/IRC.mli | 4 ---- cfrontend/CPragmas.ml | 7 ++++++- driver/Frontend.ml | 1 + 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/IRC.ml b/backend/IRC.ml index b359da35..e94d6fbb 100644 --- a/backend/IRC.ml +++ b/backend/IRC.ml @@ -252,12 +252,10 @@ let class_of_loc = function let no_spill_class = 2 -let reserved_registers = ref ([]: mreg list) - let rec remove_reserved = function | [] -> [] | hd :: tl -> - if List.mem hd !reserved_registers + if List.mem hd !CPragmas.reserved_registers then remove_reserved tl else hd :: remove_reserved tl diff --git a/backend/IRC.mli b/backend/IRC.mli index 30b6d5c1..59471329 100644 --- a/backend/IRC.mli +++ b/backend/IRC.mli @@ -13,7 +13,6 @@ (* Iterated Register Coalescing: George and Appel's graph coloring algorithm *) open Registers -open Machregs open Locations open XTL @@ -39,9 +38,6 @@ val add_pref: graph -> var -> var -> unit (* Color the graph. Return an assignment of locations to variables. *) val coloring: graph -> (var -> loc) -(* Machine registers that are reserved and not available for allocation. *) -val reserved_registers: mreg list ref - (* Auxiliaries to deal with register classes *) val class_of_type: AST.typ -> int val class_of_loc: loc -> int diff --git a/cfrontend/CPragmas.ml b/cfrontend/CPragmas.ml index 44660718..ce2cfcf0 100644 --- a/cfrontend/CPragmas.ml +++ b/cfrontend/CPragmas.ml @@ -49,13 +49,15 @@ let process_use_section_pragma classname id = (* #pragma reserve_register *) +let reserved_registers = ref ([]: Machregs.mreg list) + let process_reserve_register_pragma name = match Machregsaux.register_by_name name with | None -> C2C.error "unknown register in `reserve_register' pragma" | Some r -> if Machregsaux.can_reserve_register r then - IRC.reserved_registers := r :: !IRC.reserved_registers + reserved_registers := r :: !reserved_registers else C2C.error "cannot reserve this register (not a callee-save)" @@ -84,5 +86,8 @@ let process_pragma name = | _ -> false +let reset () = + reserved_registers := [] + let initialize () = C2C.process_pragma_hook := process_pragma diff --git a/driver/Frontend.ml b/driver/Frontend.ml index 74791247..bb97e945 100644 --- a/driver/Frontend.ml +++ b/driver/Frontend.ml @@ -75,6 +75,7 @@ let preprocess ifile ofile = let parse_c_file sourcename ifile = Debug.init_compile_unit sourcename; Sections.initialize(); + CPragmas.reset(); (* Simplification options *) let simplifs = "b" (* blocks: mandatory *) -- cgit From 64fe7f462c4dd204ac5ffaed48edbf9698485d94 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 17 Apr 2020 17:26:15 +0200 Subject: Simplify the generation of driver/Version.ml Don't use sed, just echo the contents of the file. --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index af069e3f..aed0da28 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,11 @@ ####################################################################### include Makefile.config +include VERSION + +BUILDVERSION ?= $(version) +BUILDNR ?= $(buildnr) +TAG ?= $(tag) ifeq ($(wildcard $(ARCH)_$(BITSIZE)),) ARCHDIRS=$(ARCH) @@ -220,9 +225,9 @@ compcert.ini: Makefile.config > compcert.ini driver/Version.ml: VERSION - cat VERSION \ - | sed -e 's|\(.*\)=\(.*\)|let \1 = \"\2\"|g' \ - >driver/Version.ml + (echo 'let version = "$(BUILDVERSION)"'; \ + echo 'let buildnr = "$(BUILDNR)"'; \ + echo 'let tag = "$(TAG)"';) > driver/Version.ml cparser/Parser.v: cparser/Parser.vy @rm -f $@ -- cgit From f58e6695bc29b9e29650b9e5ae8d3d718ca74281 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 23 Apr 2020 14:09:43 +0200 Subject: Updated .gitignore compile.pl is a build artefact. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index da883cff..6c10e1c3 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ /Makefile.config /.merlin /_CoqProject +/compile.pl # Generated files /.depend /.depend.extr -- cgit From cc465218dc80d4e7325622e9186c88e6a6ecdb12 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 29 Apr 2020 15:40:13 +0200 Subject: Install "compcert.config" file along the Coq development The file contains various parameters about the target processor and ABI, useful for VST and possibly other users of CompCert as a Coq library. It is in "var=val" syntax so that it can be included directly from a Makefile or a shell script. --- .gitignore | 1 + Makefile | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6c10e1c3..b75ea5e7 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ /.depend /.depend.extr /compcert.ini +/compcert.config /x86/ConstpropOp.v /x86/SelectOp.v /x86/SelectLong.v diff --git a/Makefile b/Makefile index aed0da28..df5fb03f 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,9 @@ endif ifeq ($(CLIGHTGEN),true) $(MAKE) clightgen endif +ifeq ($(INSTALL_COQDEV),true) + $(MAKE) compcert.config +endif proof: $(FILES:.v=.vo) @@ -224,6 +227,19 @@ compcert.ini: Makefile.config echo "response_file_style=$(RESPONSEFILE)";) \ > compcert.ini +compcert.config: Makefile.config + (echo "# CompCert configuration parameters"; \ + echo "COMPCERT_ARCH=$(ARCH)"; \ + echo "COMPCERT_MODEL=$(MODEL)"; \ + echo "COMPCERT_ABI=$(ABI)"; \ + echo "COMPCERT_ENDIANNESS=$(ENDIANNESS)"; \ + echo "COMPCERT_BITSIZE=$(BITSIZE)"; \ + echo "COMPCERT_SYSTEM=$(SYSTEM)"; \ + echo "COMPCERT_VERSION=$(BUILDVERSION)"; \ + echo "COMPCERT_BUILDNR=$(BUILDNR)"; \ + echo "COMPCERT_TAG=$(TAG)" \ + ) > compcert.config + driver/Version.ml: VERSION (echo 'let version = "$(BUILDVERSION)"'; \ echo 'let buildnr = "$(BUILDNR)"'; \ @@ -258,6 +274,7 @@ ifeq ($(INSTALL_COQDEV),true) install -m 0644 $$d/*.vo $(DESTDIR)$(COQDEVDIR)/$$d/; \ done install -m 0644 ./VERSION $(DESTDIR)$(COQDEVDIR) + install -m 0644 ./compcert.config $(DESTDIR)$(COQDEVDIR) @(echo "To use, pass the following to coq_makefile or add the following to _CoqProject:"; echo "-R $(COQDEVDIR) compcert") > $(DESTDIR)$(COQDEVDIR)/README endif @@ -267,7 +284,7 @@ clean: rm -f $(patsubst %, %/.*.aux, $(DIRS)) rm -rf doc/html doc/*.glob rm -f driver/Version.ml - rm -f compcert.ini + rm -f compcert.ini compcert.config rm -f extraction/STAMP extraction/*.ml extraction/*.mli .depend.extr rm -f tools/ndfun tools/modorder tools/*.cm? tools/*.o rm -f $(GENERATED) .depend -- cgit From fdf9a8a09f73c531aa7fc0e96cad02dd6011e2c9 Mon Sep 17 00:00:00 2001 From: Jacques-Henri Jourdan Date: Mon, 4 May 2020 11:37:49 +0200 Subject: Coq-MenhirLib: explicit import ListNotations (#354) import ListNotations wherever it is necessary so that we do not rely on it being exported by Program. (See #352.) This is a backport from upstream: https://gitlab.inria.fr/fpottier/menhir/-/commit/53f94fa42c80ab1728383e9d2b19006180b14a78 --- MenhirLib/Alphabet.v | 3 ++- MenhirLib/Grammar.v | 3 ++- MenhirLib/Interpreter.v | 2 ++ MenhirLib/Interpreter_complete.v | 3 ++- MenhirLib/Interpreter_correct.v | 3 ++- MenhirLib/Validator_complete.v | 1 + MenhirLib/Validator_safe.v | 1 + 7 files changed, 12 insertions(+), 4 deletions(-) diff --git a/MenhirLib/Alphabet.v b/MenhirLib/Alphabet.v index 29070e3d..530e3b4a 100644 --- a/MenhirLib/Alphabet.v +++ b/MenhirLib/Alphabet.v @@ -11,7 +11,8 @@ (* *) (****************************************************************************) -From Coq Require Import Omega List Syntax Relations RelationClasses. +From Coq Require Import Omega List Relations RelationClasses. +Import ListNotations. Local Obligation Tactic := intros. diff --git a/MenhirLib/Grammar.v b/MenhirLib/Grammar.v index a371318b..9be374e8 100644 --- a/MenhirLib/Grammar.v +++ b/MenhirLib/Grammar.v @@ -11,7 +11,8 @@ (* *) (****************************************************************************) -From Coq Require Import List Syntax Orders. +From Coq Require Import List Orders. +Import ListNotations. Require Import Alphabet. (** The terminal non-terminal alphabets of the grammar. **) diff --git a/MenhirLib/Interpreter.v b/MenhirLib/Interpreter.v index 568597ba..c36ca614 100644 --- a/MenhirLib/Interpreter.v +++ b/MenhirLib/Interpreter.v @@ -12,6 +12,7 @@ (****************************************************************************) From Coq Require Import List Syntax. +Import ListNotations. From Coq.ssr Require Import ssreflect. Require Automaton. Require Import Alphabet Grammar Validator_safe. @@ -82,6 +83,7 @@ Proof. by rewrite /cast -Eqdep_dec.eq_rect_eq_dec. Qed. CoInductive buffer : Type := Buf_cons { buf_head : token; buf_tail : buffer }. +Declare Scope buffer_scope. Delimit Scope buffer_scope with buf. Bind Scope buffer_scope with buffer. diff --git a/MenhirLib/Interpreter_complete.v b/MenhirLib/Interpreter_complete.v index ec69592b..51f2524b 100644 --- a/MenhirLib/Interpreter_complete.v +++ b/MenhirLib/Interpreter_complete.v @@ -11,7 +11,8 @@ (* *) (****************************************************************************) -From Coq Require Import List Syntax Arith. +From Coq Require Import List Arith. +Import ListNotations. From Coq.ssr Require Import ssreflect. Require Import Alphabet Grammar. Require Automaton Interpreter Validator_complete. diff --git a/MenhirLib/Interpreter_correct.v b/MenhirLib/Interpreter_correct.v index 1325f610..083be5b7 100644 --- a/MenhirLib/Interpreter_correct.v +++ b/MenhirLib/Interpreter_correct.v @@ -11,7 +11,8 @@ (* *) (****************************************************************************) -From Coq Require Import List Syntax. +From Coq Require Import List. +Import ListNotations. Require Import Alphabet. Require Grammar Automaton Interpreter. From Coq.ssr Require Import ssreflect. diff --git a/MenhirLib/Validator_complete.v b/MenhirLib/Validator_complete.v index ebb74500..9ba3e53c 100644 --- a/MenhirLib/Validator_complete.v +++ b/MenhirLib/Validator_complete.v @@ -13,6 +13,7 @@ From Coq Require Import List Syntax Derive. From Coq.ssr Require Import ssreflect. +Import ListNotations. Require Automaton. Require Import Alphabet Validator_classes. diff --git a/MenhirLib/Validator_safe.v b/MenhirLib/Validator_safe.v index 628d2009..e7a54b47 100644 --- a/MenhirLib/Validator_safe.v +++ b/MenhirLib/Validator_safe.v @@ -12,6 +12,7 @@ (****************************************************************************) From Coq Require Import List Syntax Derive. +Import ListNotations. From Coq.ssr Require Import ssreflect. Require Automaton. Require Import Alphabet Validator_classes. -- cgit From 2cccb81243c5b2f45085634ffe070adc1ebb0c1b Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 4 May 2020 11:43:40 +0200 Subject: Do not use "Declare Scope", introduced in Coq 8.10 only --- MenhirLib/Interpreter.v | 1 - 1 file changed, 1 deletion(-) diff --git a/MenhirLib/Interpreter.v b/MenhirLib/Interpreter.v index c36ca614..07aeae5a 100644 --- a/MenhirLib/Interpreter.v +++ b/MenhirLib/Interpreter.v @@ -83,7 +83,6 @@ Proof. by rewrite /cast -Eqdep_dec.eq_rect_eq_dec. Qed. CoInductive buffer : Type := Buf_cons { buf_head : token; buf_tail : buffer }. -Declare Scope buffer_scope. Delimit Scope buffer_scope with buf. Bind Scope buffer_scope with buffer. -- cgit From f070949a7559675af3e551e16e5cae95af5d4285 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 4 May 2020 11:51:12 +0200 Subject: Do not use the list notation `[]` The rest of the code base uses `nil`, so let's be consistent. Also, this avoids depending on `Import ListNotations`. --- lib/Floats.v | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Floats.v b/lib/Floats.v index 13350dd0..00d00a57 100644 --- a/lib/Floats.v +++ b/lib/Floats.v @@ -223,10 +223,10 @@ Definition cons_pl (x: float) (l: list (bool * positive)) := match x with B754_nan s p _ => (s, p) :: l | _ => l end. Definition unop_nan (x: float) : {x : float | is_nan _ _ x = true} := - quiet_nan_64 (Archi.choose_nan_64 (cons_pl x [])). + quiet_nan_64 (Archi.choose_nan_64 (cons_pl x nil)). Definition binop_nan (x y: float) : {x : float | is_nan _ _ x = true} := - quiet_nan_64 (Archi.choose_nan_64 (cons_pl x (cons_pl y []))). + quiet_nan_64 (Archi.choose_nan_64 (cons_pl x (cons_pl y nil))). (** For fused multiply-add, the order in which arguments are examined to select a NaN payload varies across platforms. E.g. in [fma x y z], @@ -236,7 +236,7 @@ Definition binop_nan (x y: float) : {x : float | is_nan _ _ x = true} := Definition fma_nan_1 (x y z: float) : {x : float | is_nan _ _ x = true} := let '(a, b, c) := Archi.fma_order x y z in - quiet_nan_64 (Archi.choose_nan_64 (cons_pl a (cons_pl b (cons_pl c [])))). + quiet_nan_64 (Archi.choose_nan_64 (cons_pl a (cons_pl b (cons_pl c nil)))). (** One last wrinkle for fused multiply-add: [fma zero infinity nan] can return either the quiesced [nan], or the default NaN arising out @@ -248,7 +248,7 @@ Definition fma_nan (x y z: float) : {x : float | is_nan _ _ x = true} := match x, y with | B754_infinity _, B754_zero _ | B754_zero _, B754_infinity _ => if Archi.fma_invalid_mul_is_nan - then quiet_nan_64 (Archi.choose_nan_64 (Archi.default_nan_64 :: cons_pl z [])) + then quiet_nan_64 (Archi.choose_nan_64 (Archi.default_nan_64 :: cons_pl z nil)) else fma_nan_1 x y z | _, _ => fma_nan_1 x y z @@ -1011,20 +1011,20 @@ Definition cons_pl (x: float32) (l: list (bool * positive)) := match x with B754_nan s p _ => (s, p) :: l | _ => l end. Definition unop_nan (x: float32) : {x : float32 | is_nan _ _ x = true} := - quiet_nan_32 (Archi.choose_nan_32 (cons_pl x [])). + quiet_nan_32 (Archi.choose_nan_32 (cons_pl x nil)). Definition binop_nan (x y: float32) : {x : float32 | is_nan _ _ x = true} := - quiet_nan_32 (Archi.choose_nan_32 (cons_pl x (cons_pl y []))). + quiet_nan_32 (Archi.choose_nan_32 (cons_pl x (cons_pl y nil))). Definition fma_nan_1 (x y z: float32) : {x : float32 | is_nan _ _ x = true} := let '(a, b, c) := Archi.fma_order x y z in - quiet_nan_32 (Archi.choose_nan_32 (cons_pl a (cons_pl b (cons_pl c [])))). + quiet_nan_32 (Archi.choose_nan_32 (cons_pl a (cons_pl b (cons_pl c nil)))). Definition fma_nan (x y z: float32) : {x : float32 | is_nan _ _ x = true} := match x, y with | B754_infinity _, B754_zero _ | B754_zero _, B754_infinity _ => if Archi.fma_invalid_mul_is_nan - then quiet_nan_32 (Archi.choose_nan_32 (Archi.default_nan_32 :: cons_pl z [])) + then quiet_nan_32 (Archi.choose_nan_32 (Archi.default_nan_32 :: cons_pl z nil)) else fma_nan_1 x y z | _, _ => fma_nan_1 x y z -- cgit From 65ad896aed67aa06845e0b2ac9f7f98179f6e170 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 4 May 2020 12:03:05 +0200 Subject: Revert "Do not use the list notation `[]`" On some versions of Coq, "nil" is of type "Rlist"... This reverts commit f070949a7559675af3e551e16e5cae95af5d4285. --- lib/Floats.v | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Floats.v b/lib/Floats.v index 00d00a57..13350dd0 100644 --- a/lib/Floats.v +++ b/lib/Floats.v @@ -223,10 +223,10 @@ Definition cons_pl (x: float) (l: list (bool * positive)) := match x with B754_nan s p _ => (s, p) :: l | _ => l end. Definition unop_nan (x: float) : {x : float | is_nan _ _ x = true} := - quiet_nan_64 (Archi.choose_nan_64 (cons_pl x nil)). + quiet_nan_64 (Archi.choose_nan_64 (cons_pl x [])). Definition binop_nan (x y: float) : {x : float | is_nan _ _ x = true} := - quiet_nan_64 (Archi.choose_nan_64 (cons_pl x (cons_pl y nil))). + quiet_nan_64 (Archi.choose_nan_64 (cons_pl x (cons_pl y []))). (** For fused multiply-add, the order in which arguments are examined to select a NaN payload varies across platforms. E.g. in [fma x y z], @@ -236,7 +236,7 @@ Definition binop_nan (x y: float) : {x : float | is_nan _ _ x = true} := Definition fma_nan_1 (x y z: float) : {x : float | is_nan _ _ x = true} := let '(a, b, c) := Archi.fma_order x y z in - quiet_nan_64 (Archi.choose_nan_64 (cons_pl a (cons_pl b (cons_pl c nil)))). + quiet_nan_64 (Archi.choose_nan_64 (cons_pl a (cons_pl b (cons_pl c [])))). (** One last wrinkle for fused multiply-add: [fma zero infinity nan] can return either the quiesced [nan], or the default NaN arising out @@ -248,7 +248,7 @@ Definition fma_nan (x y z: float) : {x : float | is_nan _ _ x = true} := match x, y with | B754_infinity _, B754_zero _ | B754_zero _, B754_infinity _ => if Archi.fma_invalid_mul_is_nan - then quiet_nan_64 (Archi.choose_nan_64 (Archi.default_nan_64 :: cons_pl z nil)) + then quiet_nan_64 (Archi.choose_nan_64 (Archi.default_nan_64 :: cons_pl z [])) else fma_nan_1 x y z | _, _ => fma_nan_1 x y z @@ -1011,20 +1011,20 @@ Definition cons_pl (x: float32) (l: list (bool * positive)) := match x with B754_nan s p _ => (s, p) :: l | _ => l end. Definition unop_nan (x: float32) : {x : float32 | is_nan _ _ x = true} := - quiet_nan_32 (Archi.choose_nan_32 (cons_pl x nil)). + quiet_nan_32 (Archi.choose_nan_32 (cons_pl x [])). Definition binop_nan (x y: float32) : {x : float32 | is_nan _ _ x = true} := - quiet_nan_32 (Archi.choose_nan_32 (cons_pl x (cons_pl y nil))). + quiet_nan_32 (Archi.choose_nan_32 (cons_pl x (cons_pl y []))). Definition fma_nan_1 (x y z: float32) : {x : float32 | is_nan _ _ x = true} := let '(a, b, c) := Archi.fma_order x y z in - quiet_nan_32 (Archi.choose_nan_32 (cons_pl a (cons_pl b (cons_pl c nil)))). + quiet_nan_32 (Archi.choose_nan_32 (cons_pl a (cons_pl b (cons_pl c [])))). Definition fma_nan (x y z: float32) : {x : float32 | is_nan _ _ x = true} := match x, y with | B754_infinity _, B754_zero _ | B754_zero _, B754_infinity _ => if Archi.fma_invalid_mul_is_nan - then quiet_nan_32 (Archi.choose_nan_32 (Archi.default_nan_32 :: cons_pl z nil)) + then quiet_nan_32 (Archi.choose_nan_32 (Archi.default_nan_32 :: cons_pl z [])) else fma_nan_1 x y z | _, _ => fma_nan_1 x y z -- cgit From e464549037dcf94494c5aea462e6c3854b44976d Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 4 May 2020 12:04:38 +0200 Subject: Import ListNotations explicitly So as not to depend on an implicit import from module Program. (See PR #352.) --- lib/Floats.v | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Floats.v b/lib/Floats.v index 13350dd0..6a126c3f 100644 --- a/lib/Floats.v +++ b/lib/Floats.v @@ -22,6 +22,7 @@ Require Import Binary Bits Core. Require Import IEEE754_extra. Require Import Program. Require Archi. +Import ListNotations. Close Scope R_scope. Open Scope Z_scope. -- cgit From e13dd0e143dea85eba9c9dcb79c32f04a152221e Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sun, 3 May 2020 09:43:14 +0200 Subject: Dual-license aarch64/{Archi.v,Cbuiltins.ml,extractionMachdep.v} The corresponding files in all other ports are dual-licensed (GPL + non-commercial), there is no reason it should be different for aarch64. --- aarch64/Archi.v | 3 +++ aarch64/CBuiltins.ml | 3 +++ aarch64/extractionMachdep.v | 3 +++ 3 files changed, 9 insertions(+) diff --git a/aarch64/Archi.v b/aarch64/Archi.v index aef4ab77..24431cb2 100644 --- a/aarch64/Archi.v +++ b/aarch64/Archi.v @@ -6,6 +6,9 @@ (* *) (* Copyright Institut National de Recherche en Informatique et en *) (* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) (* under the terms of the INRIA Non-Commercial License Agreement. *) (* *) (* *********************************************************************) diff --git a/aarch64/CBuiltins.ml b/aarch64/CBuiltins.ml index fdc1372d..dfd5b768 100644 --- a/aarch64/CBuiltins.ml +++ b/aarch64/CBuiltins.ml @@ -6,6 +6,9 @@ (* *) (* Copyright Institut National de Recherche en Informatique et en *) (* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) (* under the terms of the INRIA Non-Commercial License Agreement. *) (* *) (* *********************************************************************) diff --git a/aarch64/extractionMachdep.v b/aarch64/extractionMachdep.v index e82056e2..5f26dc28 100644 --- a/aarch64/extractionMachdep.v +++ b/aarch64/extractionMachdep.v @@ -6,6 +6,9 @@ (* *) (* Copyright Institut National de Recherche en Informatique et en *) (* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) (* under the terms of the INRIA Non-Commercial License Agreement. *) (* *) (* *********************************************************************) -- cgit From b46c0c01379da17dd96fc0cb8f0458100b7b1e5e Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 4 May 2020 10:51:47 +0200 Subject: Update the list of dual-licensed files Closes: #351 --- LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 5a7ae79f..61b84219 100644 --- a/LICENSE +++ b/LICENSE @@ -46,8 +46,8 @@ option) any later version: all files in the exportclight/ directory - the Archi.v, CBuiltins.ml, and extractionMachdep.v files - in directories arm, powerpc, riscV, x86, x86_32, x86_64 + the Archi.v, Builtins1.v, CBuiltins.ml, and extractionMachdep.v files + in directories aarch64, arm, powerpc, riscV, x86, x86_32, x86_64 extraction/extraction.v -- cgit From 4a676623badb718da4055b7f26ee05f5097f4e7b Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 4 May 2020 11:11:27 +0200 Subject: Move Commandline to the lib/ directory The Commandline module is reusable in other projects, and its license (GPL) allows such reuse, so its natural place is in lib/ rather than in driver/ --- driver/Commandline.ml | 141 ------------------------------------------------- driver/Commandline.mli | 55 ------------------- lib/Commandline.ml | 141 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/Commandline.mli | 55 +++++++++++++++++++ 4 files changed, 196 insertions(+), 196 deletions(-) delete mode 100644 driver/Commandline.ml delete mode 100644 driver/Commandline.mli create mode 100644 lib/Commandline.ml create mode 100644 lib/Commandline.mli diff --git a/driver/Commandline.ml b/driver/Commandline.ml deleted file mode 100644 index 672ed834..00000000 --- a/driver/Commandline.ml +++ /dev/null @@ -1,141 +0,0 @@ -(* *********************************************************************) -(* *) -(* The Compcert verified compiler *) -(* *) -(* Xavier Leroy, INRIA Paris-Rocquencourt *) -(* *) -(* Copyright Institut National de Recherche en Informatique et en *) -(* Automatique. All rights reserved. This file is distributed *) -(* under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 2 of the License, or *) -(* (at your option) any later version. This file is also distributed *) -(* under the terms of the INRIA Non-Commercial License Agreement. *) -(* *) -(* *********************************************************************) - -(* Parsing of command-line flags and arguments *) - -open Printf - -type pattern = - | Exact of string - | Prefix of string - | Suffix of string - | Regexp of Str.regexp - -let _Regexp re = Regexp (Str.regexp re) - -type action = - | Set of bool ref - | Unset of bool ref - | Self of (string -> unit) - | String of (string -> unit) - | Integer of (int -> unit) - | Ignore - | Unit of (unit -> unit) - -exception CmdError of string - -let match_pattern text = function - | Exact s -> - text = s - | Prefix pref -> - let lpref = String.length pref and ltext = String.length text in - lpref < ltext && String.sub text 0 lpref = pref - (* strict prefix: no match if pref = text. See below. *) - | Suffix suff -> - let lsuff = String.length suff and ltext = String.length text in - lsuff < ltext && String.sub text (ltext - lsuff) lsuff = suff - (* strict suffix: no match if suff = text, so that e.g. ".c" - causes an error rather than being treated as a C source file. *) - | Regexp re -> - Str.string_match re text 0 - -let rec find_action text = function - | [] -> None - | (pat, act) :: rem -> - if match_pattern text pat then Some act else find_action text rem - -let parse_array spec argv first last = - (* Split the spec into Exact patterns (in a hashtable) and other patterns *) - let exact_cases = (Hashtbl.create 29 : (string, action) Hashtbl.t) in - let rec split_spec = function - | [] -> [] - | (Exact s, act) :: rem -> Hashtbl.add exact_cases s act; split_spec rem - | (pat, act) :: rem -> (pat, act) :: split_spec rem in - let inexact_cases = split_spec spec in - (* Parse the vector of arguments *) - let rec parse i = - if i <= last then begin - let s = argv.(i) in - let optact = - try Some (Hashtbl.find exact_cases s) - with Not_found -> find_action s inexact_cases in - match optact with - | None -> - let msg = sprintf "unknown argument `%s'" s in - raise (CmdError msg) - | Some(Set r) -> - r := true; parse (i+1) - | Some(Unset r) -> - r := false; parse (i+1) - | Some(Self fn) -> - fn s; parse (i+1) - | Some(String fn) -> - if i + 1 <= last then begin - fn argv.(i+1); parse (i+2) - end else begin - let msg = sprintf "option `%s' expects an argument" s in - raise (CmdError msg) - end - | Some(Integer fn) -> - if i + 1 <= last then begin - let n = - try - int_of_string argv.(i+1) - with Failure _ -> - let msg = sprintf "argument to option `%s' must be an integer" s in - raise (CmdError msg) - in - fn n; parse (i+2) - end else begin - let msg = sprintf "option `%s' expects an argument" s in - raise (CmdError msg) - end - | Some (Ignore) -> - if i + 1 <= last then begin - parse (i+2) - end else begin - let msg = sprintf "option `%s' expects an argument" s in - raise (CmdError msg) - end - | Some (Unit f) -> f (); parse (i+1) - end - in parse first - -let argv = - try - Responsefile.expandargv Sys.argv - with Responsefile.Error msg | Sys_error msg -> - eprintf "Error while processing the command line: %s\n" msg; - exit 2 - -let parse_cmdline spec = - parse_array spec argv 1 (Array.length argv - 1) - -let long_int_action key s = - let ls = String.length s - and lkey = String.length key in - assert (ls > lkey); - let s = String.sub s (lkey + 1) (ls - lkey - 1) in - try - int_of_string s - with Failure _ -> - let msg = sprintf "argument to option `%s' must be an integer" key in - raise (CmdError msg) - -let longopt_int key f = - let act s = - let n = long_int_action key s in - f n in - Prefix (key ^ "="),Self act diff --git a/driver/Commandline.mli b/driver/Commandline.mli deleted file mode 100644 index 8bb6f18f..00000000 --- a/driver/Commandline.mli +++ /dev/null @@ -1,55 +0,0 @@ -(* *********************************************************************) -(* *) -(* The Compcert verified compiler *) -(* *) -(* Xavier Leroy, INRIA Paris-Rocquencourt *) -(* *) -(* Copyright Institut National de Recherche en Informatique et en *) -(* Automatique. All rights reserved. This file is distributed *) -(* under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 2 of the License, or *) -(* (at your option) any later version. This file is also distributed *) -(* under the terms of the INRIA Non-Commercial License Agreement. *) -(* *) -(* *********************************************************************) - -(* Parsing of command-line flags and arguments *) - -(* A command-line specification is a list of pairs (pattern, action). - Command-line words are matched against the patterns, and the - corresponding actions are invoked. *) - -type pattern = - | Exact of string (** exactly this string *) - | Prefix of string (** any string starting with this prefix *) - | Suffix of string (** any string ending with this suffix *) - | Regexp of Str.regexp (** any string matching this anchored regexp *) - -val _Regexp: string -> pattern (** text of an [Str] regexp *) - -type action = - | Set of bool ref (** set the given ref to true *) - | Unset of bool ref (** set the given ref to false *) - | Self of (string -> unit) (** call the function with the matched string *) - | String of (string -> unit) (** read next arg as a string, call function *) - | Integer of (int -> unit) (** read next arg as an int, call function *) - | Ignore (** ignore the next arg *) - | Unit of (unit -> unit) (** call the function with unit as argument *) -(* Note on precedence: [Exact] patterns are tried first, then the other - patterns are tried in the order in which they appear in the list. *) - -exception CmdError of string -(** Raise by [parse_cmdline] when an error occurred *) - -val parse_cmdline: (pattern * action) list -> unit -(** [parse_cmdline actions] parses the command line (after @-file expansion) - and performs all [actions]. Raises [CmdError] if an error occurred. -*) - -val longopt_int: string -> (int -> unit) -> pattern * action -(** [longopt_int key fn] generates a pattern and an action for - options of the form [key=] and calls [fn] with the integer argument -*) - -val argv: string array -(** [argv] contains the complete command line after @-file expandsion *) diff --git a/lib/Commandline.ml b/lib/Commandline.ml new file mode 100644 index 00000000..672ed834 --- /dev/null +++ b/lib/Commandline.ml @@ -0,0 +1,141 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Parsing of command-line flags and arguments *) + +open Printf + +type pattern = + | Exact of string + | Prefix of string + | Suffix of string + | Regexp of Str.regexp + +let _Regexp re = Regexp (Str.regexp re) + +type action = + | Set of bool ref + | Unset of bool ref + | Self of (string -> unit) + | String of (string -> unit) + | Integer of (int -> unit) + | Ignore + | Unit of (unit -> unit) + +exception CmdError of string + +let match_pattern text = function + | Exact s -> + text = s + | Prefix pref -> + let lpref = String.length pref and ltext = String.length text in + lpref < ltext && String.sub text 0 lpref = pref + (* strict prefix: no match if pref = text. See below. *) + | Suffix suff -> + let lsuff = String.length suff and ltext = String.length text in + lsuff < ltext && String.sub text (ltext - lsuff) lsuff = suff + (* strict suffix: no match if suff = text, so that e.g. ".c" + causes an error rather than being treated as a C source file. *) + | Regexp re -> + Str.string_match re text 0 + +let rec find_action text = function + | [] -> None + | (pat, act) :: rem -> + if match_pattern text pat then Some act else find_action text rem + +let parse_array spec argv first last = + (* Split the spec into Exact patterns (in a hashtable) and other patterns *) + let exact_cases = (Hashtbl.create 29 : (string, action) Hashtbl.t) in + let rec split_spec = function + | [] -> [] + | (Exact s, act) :: rem -> Hashtbl.add exact_cases s act; split_spec rem + | (pat, act) :: rem -> (pat, act) :: split_spec rem in + let inexact_cases = split_spec spec in + (* Parse the vector of arguments *) + let rec parse i = + if i <= last then begin + let s = argv.(i) in + let optact = + try Some (Hashtbl.find exact_cases s) + with Not_found -> find_action s inexact_cases in + match optact with + | None -> + let msg = sprintf "unknown argument `%s'" s in + raise (CmdError msg) + | Some(Set r) -> + r := true; parse (i+1) + | Some(Unset r) -> + r := false; parse (i+1) + | Some(Self fn) -> + fn s; parse (i+1) + | Some(String fn) -> + if i + 1 <= last then begin + fn argv.(i+1); parse (i+2) + end else begin + let msg = sprintf "option `%s' expects an argument" s in + raise (CmdError msg) + end + | Some(Integer fn) -> + if i + 1 <= last then begin + let n = + try + int_of_string argv.(i+1) + with Failure _ -> + let msg = sprintf "argument to option `%s' must be an integer" s in + raise (CmdError msg) + in + fn n; parse (i+2) + end else begin + let msg = sprintf "option `%s' expects an argument" s in + raise (CmdError msg) + end + | Some (Ignore) -> + if i + 1 <= last then begin + parse (i+2) + end else begin + let msg = sprintf "option `%s' expects an argument" s in + raise (CmdError msg) + end + | Some (Unit f) -> f (); parse (i+1) + end + in parse first + +let argv = + try + Responsefile.expandargv Sys.argv + with Responsefile.Error msg | Sys_error msg -> + eprintf "Error while processing the command line: %s\n" msg; + exit 2 + +let parse_cmdline spec = + parse_array spec argv 1 (Array.length argv - 1) + +let long_int_action key s = + let ls = String.length s + and lkey = String.length key in + assert (ls > lkey); + let s = String.sub s (lkey + 1) (ls - lkey - 1) in + try + int_of_string s + with Failure _ -> + let msg = sprintf "argument to option `%s' must be an integer" key in + raise (CmdError msg) + +let longopt_int key f = + let act s = + let n = long_int_action key s in + f n in + Prefix (key ^ "="),Self act diff --git a/lib/Commandline.mli b/lib/Commandline.mli new file mode 100644 index 00000000..8bb6f18f --- /dev/null +++ b/lib/Commandline.mli @@ -0,0 +1,55 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 2 of the License, or *) +(* (at your option) any later version. This file is also distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(* Parsing of command-line flags and arguments *) + +(* A command-line specification is a list of pairs (pattern, action). + Command-line words are matched against the patterns, and the + corresponding actions are invoked. *) + +type pattern = + | Exact of string (** exactly this string *) + | Prefix of string (** any string starting with this prefix *) + | Suffix of string (** any string ending with this suffix *) + | Regexp of Str.regexp (** any string matching this anchored regexp *) + +val _Regexp: string -> pattern (** text of an [Str] regexp *) + +type action = + | Set of bool ref (** set the given ref to true *) + | Unset of bool ref (** set the given ref to false *) + | Self of (string -> unit) (** call the function with the matched string *) + | String of (string -> unit) (** read next arg as a string, call function *) + | Integer of (int -> unit) (** read next arg as an int, call function *) + | Ignore (** ignore the next arg *) + | Unit of (unit -> unit) (** call the function with unit as argument *) +(* Note on precedence: [Exact] patterns are tried first, then the other + patterns are tried in the order in which they appear in the list. *) + +exception CmdError of string +(** Raise by [parse_cmdline] when an error occurred *) + +val parse_cmdline: (pattern * action) list -> unit +(** [parse_cmdline actions] parses the command line (after @-file expansion) + and performs all [actions]. Raises [CmdError] if an error occurred. +*) + +val longopt_int: string -> (int -> unit) -> pattern * action +(** [longopt_int key fn] generates a pattern and an action for + options of the form [key=] and calls [fn] with the integer argument +*) + +val argv: string array +(** [argv] contains the complete command line after @-file expandsion *) -- cgit From 0eba6f63b6bc458d856e477f6f8ec6b78ef78c58 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 19 May 2020 10:25:45 +0200 Subject: Add a canonical encoding of identifiers as numbers and use it in clightgen (#353) Within CompCert, identifiers (names of C functions, variables, types, etc) are represented by unique positive numbers, sometimes called "atoms". In the original implementation, atoms 1, 2, ..., N are assigned to identifiers as they are encountered. The resulting number are small and are efficient when used as keys in data structures such as PTrees. However, the mapping from C source-level identifiers to atoms differs between compilation units. This is not a problem for CompCert but complicates CompCert-based verification tools that need to combine several compilation units. This commit introduces an alternate implementation of atoms, suggested by Andrew Appel. The choice between implementations is governed by the Boolean reference `Camlcoq.use_canonical_atoms`. In the alternate implementation, identifiers are converted to bit sequences via a Huffman encoding, then the bits are represented as positive numbers. The same identifier is always represented by the same number. However, the numbers are usually bigger than in the original implementation, making PTree operations slower: lookups and updates take time linear in the length of the identifier, instead of logarithmic time in the number of identifiers encountered. The CompCert compiler (the `ccomp` executable) still uses the original implementation, but the `clightgen` tool used in conjunction with the VST program logic can use either implementations: - The alternate "canonical atoms" implementation is used by default, and also if the `-canonical-idents` option is given. - The original implementation is used if the `-short-idents` option is given. Closes: #222 Closes: #311 --- exportclight/Clightdefs.v | 101 ++++++++++++++++++++++++++++++++++++++++++- exportclight/Clightgen.ml | 9 +++- exportclight/ExportClight.ml | 35 +++++++++------ lib/Camlcoq.ml | 79 +++++++++++++++++++++++++++++++-- 4 files changed, 204 insertions(+), 20 deletions(-) diff --git a/exportclight/Clightdefs.v b/exportclight/Clightdefs.v index 83d82d88..c2b38a92 100644 --- a/exportclight/Clightdefs.v +++ b/exportclight/Clightdefs.v @@ -15,7 +15,7 @@ (** All imports and definitions used by .v Clight files generated by clightgen *) -From Coq Require Import String List ZArith. +From Coq Require Import Ascii String List ZArith. From compcert Require Import Integers Floats Maps Errors AST Ctypes Cop Clight. Definition tvoid := Tvoid. @@ -80,3 +80,102 @@ Definition mkprogram (types: list composite_definition) prog_types := types; prog_comp_env := ce; prog_comp_env_eq := EQ |}. + +(** The following encoding of character strings as positive numbers + must be kept consistent with the OCaml function [Camlcoq.pos_of_string]. *) + +Definition append_bit_pos (b: bool) (p: positive) : positive := + if b then xI p else xO p. + +Definition append_char_pos_default (c: ascii) (p: positive) : positive := + let '(Ascii b7 b6 b5 b4 b3 b2 b1 b0) := c in + xI (xI (xI (xI (xI (xI + (append_bit_pos b0 (append_bit_pos b1 + (append_bit_pos b2 (append_bit_pos b3 + (append_bit_pos b4 (append_bit_pos b5 + (append_bit_pos b6 (append_bit_pos b7 p))))))))))))). + +Definition append_char_pos (c: ascii) (p: positive) : positive := + match c with + | "0"%char => xO (xO (xO (xO (xO (xO p))))) + | "1"%char => xI (xO (xO (xO (xO (xO p))))) + | "2"%char => xO (xI (xO (xO (xO (xO p))))) + | "3"%char => xI (xI (xO (xO (xO (xO p))))) + | "4"%char => xO (xO (xI (xO (xO (xO p))))) + | "5"%char => xI (xO (xI (xO (xO (xO p))))) + | "6"%char => xO (xI (xI (xO (xO (xO p))))) + | "7"%char => xI (xI (xI (xO (xO (xO p))))) + | "8"%char => xO (xO (xO (xI (xO (xO p))))) + | "9"%char => xI (xO (xO (xI (xO (xO p))))) + | "a"%char => xO (xI (xO (xI (xO (xO p))))) + | "b"%char => xI (xI (xO (xI (xO (xO p))))) + | "c"%char => xO (xO (xI (xI (xO (xO p))))) + | "d"%char => xI (xO (xI (xI (xO (xO p))))) + | "e"%char => xO (xI (xI (xI (xO (xO p))))) + | "f"%char => xI (xI (xI (xI (xO (xO p))))) + | "g"%char => xO (xO (xO (xO (xI (xO p))))) + | "h"%char => xI (xO (xO (xO (xI (xO p))))) + | "i"%char => xO (xI (xO (xO (xI (xO p))))) + | "j"%char => xI (xI (xO (xO (xI (xO p))))) + | "k"%char => xO (xO (xI (xO (xI (xO p))))) + | "l"%char => xI (xO (xI (xO (xI (xO p))))) + | "m"%char => xO (xI (xI (xO (xI (xO p))))) + | "n"%char => xI (xI (xI (xO (xI (xO p))))) + | "o"%char => xO (xO (xO (xI (xI (xO p))))) + | "p"%char => xI (xO (xO (xI (xI (xO p))))) + | "q"%char => xO (xI (xO (xI (xI (xO p))))) + | "r"%char => xI (xI (xO (xI (xI (xO p))))) + | "s"%char => xO (xO (xI (xI (xI (xO p))))) + | "t"%char => xI (xO (xI (xI (xI (xO p))))) + | "u"%char => xO (xI (xI (xI (xI (xO p))))) + | "v"%char => xI (xI (xI (xI (xI (xO p))))) + | "w"%char => xO (xO (xO (xO (xO (xI p))))) + | "x"%char => xI (xO (xO (xO (xO (xI p))))) + | "y"%char => xO (xI (xO (xO (xO (xI p))))) + | "z"%char => xI (xI (xO (xO (xO (xI p))))) + | "A"%char => xO (xO (xI (xO (xO (xI p))))) + | "B"%char => xI (xO (xI (xO (xO (xI p))))) + | "C"%char => xO (xI (xI (xO (xO (xI p))))) + | "D"%char => xI (xI (xI (xO (xO (xI p))))) + | "E"%char => xO (xO (xO (xI (xO (xI p))))) + | "F"%char => xI (xO (xO (xI (xO (xI p))))) + | "G"%char => xO (xI (xO (xI (xO (xI p))))) + | "H"%char => xI (xI (xO (xI (xO (xI p))))) + | "I"%char => xO (xO (xI (xI (xO (xI p))))) + | "J"%char => xI (xO (xI (xI (xO (xI p))))) + | "K"%char => xO (xI (xI (xI (xO (xI p))))) + | "L"%char => xI (xI (xI (xI (xO (xI p))))) + | "M"%char => xO (xO (xO (xO (xI (xI p))))) + | "N"%char => xI (xO (xO (xO (xI (xI p))))) + | "O"%char => xO (xI (xO (xO (xI (xI p))))) + | "P"%char => xI (xI (xO (xO (xI (xI p))))) + | "Q"%char => xO (xO (xI (xO (xI (xI p))))) + | "R"%char => xI (xO (xI (xO (xI (xI p))))) + | "S"%char => xO (xI (xI (xO (xI (xI p))))) + | "T"%char => xI (xI (xI (xO (xI (xI p))))) + | "U"%char => xO (xO (xO (xI (xI (xI p))))) + | "V"%char => xI (xO (xO (xI (xI (xI p))))) + | "W"%char => xO (xI (xO (xI (xI (xI p))))) + | "X"%char => xI (xI (xO (xI (xI (xI p))))) + | "Y"%char => xO (xO (xI (xI (xI (xI p))))) + | "Z"%char => xI (xO (xI (xI (xI (xI p))))) + | "_"%char => xO (xI (xI (xI (xI (xI p))))) + | _ => append_char_pos_default c p + end. + +Fixpoint ident_of_string (s: string) : ident := + match s with + | EmptyString => xH + | String c s => append_char_pos c (ident_of_string s) + end. + +(** A convenient notation [$ "ident"] to force evaluation of + [ident_of_string "ident"] *) + +Ltac ident_of_string s := + let x := constr:(ident_of_string s) in + let y := eval compute in x in + exact y. + +Notation "$ s" := (ltac:(ident_of_string s)) + (at level 1, only parsing) : string_scope. diff --git a/exportclight/Clightgen.ml b/exportclight/Clightgen.ml index f7279a5e..637454f0 100644 --- a/exportclight/Clightgen.ml +++ b/exportclight/Clightgen.ml @@ -98,6 +98,8 @@ Recognized source files: .i or .p C source file that should not be preprocessed Processing options: -normalize Normalize the generated Clight code w.r.t. loads in expressions + -canonical-idents Use canonical numbers to represent identifiers (default) + -short-idents Use canonical numbers to represent identifiers -E Preprocess only, send result to standard output -o Generate output in |} ^ @@ -142,6 +144,8 @@ let cmdline_actions = (* Processing options *) [ Exact "-E", Set option_E; Exact "-normalize", Set option_normalize; + Exact "-canonical-idents", Set Camlcoq.use_canonical_atoms; + Exact "-short-idents", Unset Camlcoq.use_canonical_atoms; Exact "-o", String(fun s -> option_o := Some s); Prefix "-o", Self (fun s -> let s = String.sub s 2 ((String.length s) - 2) in option_o := Some s);] @@ -175,12 +179,13 @@ let cmdline_actions = ] let _ = - try +try Gc.set { (Gc.get()) with Gc.minor_heap_size = 524288; (* 512k *) Gc.major_heap_increment = 4194304 (* 4M *) }; Printexc.record_backtrace true; + Camlcoq.use_canonical_atoms := true; Frontend.init (); parse_cmdline cmdline_actions; if !option_o <> None && !num_input_files >= 2 then @@ -188,7 +193,7 @@ let _ = if !num_input_files = 0 then fatal_error no_loc "no input file"; perform_actions () - with +with | Sys_error msg | CmdError msg -> error no_loc "%s" msg; exit 2 | Abort -> exit 2 diff --git a/exportclight/ExportClight.ml b/exportclight/ExportClight.ml index c9d6fced..87956b58 100644 --- a/exportclight/ExportClight.ml +++ b/exportclight/ExportClight.ml @@ -81,8 +81,12 @@ let define_idents p = string_of_atom (fun (id, name) -> try - fprintf p "Definition _%s : ident := %ld%%positive.@ " - (sanitize name) (P.to_int32 id) + if id = pos_of_string name then + fprintf p "Definition _%s : ident := $\"%s\".@ " + (sanitize name) name + else + fprintf p "Definition _%s : ident := %ld%%positive.@ " + (sanitize name) (P.to_int32 id) with Not_an_identifier -> ()); iter_hashtbl_sorted @@ -93,9 +97,11 @@ let define_idents p = fprintf p "@ " let name_temporary t = - let t1 = P.to_int t and t0 = P.to_int (first_unused_ident ()) in - if t1 >= t0 && not (Hashtbl.mem temp_names t) - then Hashtbl.add temp_names t (sprintf "_t'%d" (t1 - t0 + 1)) + if not (Hashtbl.mem string_of_atom t) && not (Hashtbl.mem temp_names t) + then begin + let t1 = P.to_int t and t0 = P.to_int (first_unused_ident ()) in + Hashtbl.add temp_names t (sprintf "_t'%d" (t1 - t0 + 1)) + end let name_opt_temporary = function | None -> () @@ -468,7 +474,7 @@ let print_assertion p (txt, targs) = | Text _ -> () | Param n -> max_param := max n !max_param) frags; - fprintf p " | \"%s\"%%string, " txt; + fprintf p " | \"%s\", " txt; list_iteri (fun i targ -> fprintf p "_x%d :: " (i + 1)) targs; @@ -495,7 +501,8 @@ let print_assertions p = let prologue = "\ From Coq Require Import String List ZArith.\n\ From compcert Require Import Coqlib Integers Floats AST Ctypes Cop Clight Clightdefs.\n\ -Local Open Scope Z_scope.\n" +Local Open Scope Z_scope.\n\ +Local Open Scope string_scope.\n" (* Naming the compiler-generated temporaries occurring in the program *) @@ -554,15 +561,15 @@ let name_program p = let print_clightgen_info p sourcefile normalized = fprintf p "@[Module Info."; - fprintf p "@ Definition version := %S%%string." Version.version; - fprintf p "@ Definition build_number := %S%%string." Version.buildnr; - fprintf p "@ Definition build_tag := %S%%string." Version.tag; - fprintf p "@ Definition arch := %S%%string." Configuration.arch; - fprintf p "@ Definition model := %S%%string." Configuration.model; - fprintf p "@ Definition abi := %S%%string." Configuration.abi; + fprintf p "@ Definition version := %S." Version.version; + fprintf p "@ Definition build_number := %S." Version.buildnr; + fprintf p "@ Definition build_tag := %S." Version.tag; + fprintf p "@ Definition arch := %S." Configuration.arch; + fprintf p "@ Definition model := %S." Configuration.model; + fprintf p "@ Definition abi := %S." Configuration.abi; fprintf p "@ Definition bitsize := %d." (if Archi.ptr64 then 64 else 32); fprintf p "@ Definition big_endian := %B." Archi.big_endian; - fprintf p "@ Definition source_file := %S%%string." sourcefile; + fprintf p "@ Definition source_file := %S." sourcefile; fprintf p "@ Definition normalized := %B." normalized; fprintf p "@]@ End Info.@ @ " diff --git a/lib/Camlcoq.ml b/lib/Camlcoq.ml index 66322efb..af65b28e 100644 --- a/lib/Camlcoq.ml +++ b/lib/Camlcoq.ml @@ -282,23 +282,96 @@ type atom = positive let atom_of_string = (Hashtbl.create 17 : (string, atom) Hashtbl.t) let string_of_atom = (Hashtbl.create 17 : (atom, string) Hashtbl.t) let next_atom = ref Coq_xH +let use_canonical_atoms = ref false + +(* If [use_canonical_atoms] is false, strings are numbered from 1 up + in the order in which they are encountered. This produces small + numbers, and is therefore efficient, but the number for a given + string may differ between the compilation of different units. + + If [use_canonical_atoms] is true, strings are Huffman-encoded as bit + sequences, which are then encoded as positive numbers. The same + string is always represented by the same number in all compilation + units. However, the numbers are bigger than in the first + implementation. Also, this places a hard limit on the number of + fresh identifiers that can be generated starting with + [first_unused_ident]. *) + +let rec append_bits_pos nbits n p = + if nbits <= 0 then p else + if n land 1 = 0 + then Coq_xO (append_bits_pos (nbits - 1) (n lsr 1) p) + else Coq_xI (append_bits_pos (nbits - 1) (n lsr 1) p) + +(* The encoding of strings as bit sequences is optimized for C identifiers: + - numbers are encoded as a 6-bit integer between 0 and 9 + - lowercase letters are encoded as a 6-bit integer between 10 and 35 + - uppercase letters are encoded as a 6-bit integer between 36 and 61 + - the underscore character is encoded as the 6-bit integer 62 + - all other characters are encoded as 6 "one" bits followed by + the 8-bit encoding of the character. *) + +let append_char_pos c p = + match c with + | '0'..'9' -> append_bits_pos 6 (Char.code c - Char.code '0') p + | 'a'..'z' -> append_bits_pos 6 (Char.code c - Char.code 'a' + 10) p + | 'A'..'Z' -> append_bits_pos 6 (Char.code c - Char.code 'A' + 36) p + | '_' -> append_bits_pos 6 62 p + | _ -> append_bits_pos 6 63 (append_bits_pos 8 (Char.code c) p) + +(* The empty string is represented as the positive "1", that is, [xH]. *) + +let pos_of_string s = + let rec encode i accu = + if i < 0 then accu else encode (i - 1) (append_char_pos s.[i] accu) + in encode (String.length s - 1) Coq_xH + +let fresh_atom () = + let a = !next_atom in + next_atom := Pos.succ !next_atom; + a let intern_string s = try Hashtbl.find atom_of_string s with Not_found -> - let a = !next_atom in - next_atom := Pos.succ !next_atom; + let a = + if !use_canonical_atoms then pos_of_string s else fresh_atom () in Hashtbl.add atom_of_string s a; Hashtbl.add string_of_atom a s; a + let extern_atom a = try Hashtbl.find string_of_atom a with Not_found -> Printf.sprintf "$%d" (P.to_int a) -let first_unused_ident () = !next_atom +(* Ignoring the terminating "1" bit, canonical encodings of strings can + be viewed as lists of bits, formed by concatenation of 6-bit fragments + (for letters, numbers, and underscore) and 14-bit fragments (for other + characters). Hence, not all positive numbers are canonical encodings: + only those whose log2 is of the form [6n + 14m]. + + Here are the first intervals of positive numbers corresponding to strings: + - [1, 1] for the empty string + - [2^6, 2^7-1] for one "compact" character + - [2^12, 2^13-1] for two "compact" characters + - [2^14, 2^14-1] for one "escaped" character + + Hence, between 2^7 and 2^12 - 1, we have 3968 consecutive positive + numbers that cannot be the encoding of a string. These are the positive + numbers we'll use as temporaries in the SimplExpr pass if canonical + atoms are in use. + + If short atoms are used, we just number the temporaries consecutively + starting one above the last generated atom. +*) + +let first_unused_ident () = + if !use_canonical_atoms + then P.of_int 128 + else !next_atom (* Strings *) -- cgit From 18859319b1daee0abb32bbc4e89ec5865a6fe082 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 1 Jun 2020 11:05:15 +0200 Subject: clightgen -short-idents : do not use $"xxx" notation ever In the original code, collisions could occur: an identifier could be numbered with a number that happens to be equal to its canonical encoding. This was harmless but confusing. Closes: #358 --- exportclight/ExportClight.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exportclight/ExportClight.ml b/exportclight/ExportClight.ml index 87956b58..96947545 100644 --- a/exportclight/ExportClight.ml +++ b/exportclight/ExportClight.ml @@ -81,7 +81,7 @@ let define_idents p = string_of_atom (fun (id, name) -> try - if id = pos_of_string name then + if !use_canonical_atoms && id = pos_of_string name then fprintf p "Definition _%s : ident := $\"%s\".@ " (sanitize name) name else -- cgit From 08491de0566dbd8cfe7a9cd4ca129a5a05caf196 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 1 Jun 2020 11:08:01 +0200 Subject: clightgen: fix usage message Closes: #358 --- exportclight/Clightgen.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exportclight/Clightgen.ml b/exportclight/Clightgen.ml index 637454f0..5e27370e 100644 --- a/exportclight/Clightgen.ml +++ b/exportclight/Clightgen.ml @@ -91,7 +91,7 @@ let process_i_file sourcename = compile_c_file sourcename sourcename ofile let usage_string = - version_string tool_name^ + version_string tool_name ^ {|Usage: clightgen [options] Recognized source files: .c C source file @@ -99,7 +99,7 @@ Recognized source files: Processing options: -normalize Normalize the generated Clight code w.r.t. loads in expressions -canonical-idents Use canonical numbers to represent identifiers (default) - -short-idents Use canonical numbers to represent identifiers + -short-idents Use small, non-canonical numbers to represent identifiers -E Preprocess only, send result to standard output -o Generate output in |} ^ -- cgit From 8f750f2d4d68192d92b6363490e8a8e577f55584 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 5 Jun 2020 16:43:43 +0200 Subject: clightgen: fix the printing of annotations The printing of EF_annot and EF_annot_val was missing the extra "kind" parameter introduced in commit 6a010b4. Also: the automatic translation of annotations into Coq assertions was confusing and prevented other uses of __builtin_annot statements in conjunction with clightgen. I believe it was never used. This commit removes this translation. Closes: #360 --- exportclight/ExportClight.ml | 67 ++++++-------------------------------------- test/clightgen/annotations.c | 6 ++++ 2 files changed, 14 insertions(+), 59 deletions(-) create mode 100644 test/clightgen/annotations.c diff --git a/exportclight/ExportClight.ml b/exportclight/ExportClight.ml index 96947545..321ed8c9 100644 --- a/exportclight/ExportClight.ml +++ b/exportclight/ExportClight.ml @@ -253,8 +253,6 @@ let signatur p sg = astrettype sg.sig_res callconv sg.sig_cc -let assertions = ref ([]: (string * typ list) list) - let external_function p = function | EF_external(name, sg) -> fprintf p "@[(EF_external %a@ %a)@]" coqstring name signatur sg @@ -270,14 +268,15 @@ let external_function p = function | EF_free -> fprintf p "EF_free" | EF_memcpy(sz, al) -> fprintf p "(EF_memcpy %ld %ld)" (Z.to_int32 sz) (Z.to_int32 al) - | EF_annot(kind,text, targs) -> - assertions := (camlstring_of_coqstring text, targs) :: !assertions; - fprintf p "(EF_annot %a %a)" coqstring text (print_list asttype) targs - | EF_annot_val(kind,text, targ) -> - assertions := (camlstring_of_coqstring text, [targ]) :: !assertions; - fprintf p "(EF_annot_val %a %a)" coqstring text asttype targ + | EF_annot(kind, text, targs) -> + fprintf p "(EF_annot %ld%%positive %a %a)" + (P.to_int32 kind) coqstring text (print_list asttype) targs + | EF_annot_val(kind, text, targ) -> + fprintf p "(EF_annot_val %ld%%positive %a %a)" + (P.to_int32 kind) coqstring text asttype targ | EF_debug(kind, text, targs) -> - fprintf p "(EF_debug %ld%%positive %ld%%positive %a)" (P.to_int32 kind) (P.to_int32 text) (print_list asttype) targs + fprintf p "(EF_debug %ld%%positive %ld%%positive %a)" + (P.to_int32 kind) (P.to_int32 text) (print_list asttype) targs | EF_inline_asm(text, sg, clob) -> fprintf p "@[(EF_inline_asm %a@ %a@ %a)@]" coqstring text @@ -447,55 +446,6 @@ let print_composite_definition p (Composite(id, su, m, a)) = (print_list (print_pair ident typ)) m attribute a -(* Assertion processing *) - -let re_annot_param = Str.regexp "%%\\|%[1-9][0-9]*" - -type fragment = Text of string | Param of int - -(* For compatibility with OCaml < 4.00 *) -let list_iteri f l = - let rec iteri i = function - | [] -> () - | a::l -> f i a; iteri (i + 1) l - in iteri 0 l - -let print_assertion p (txt, targs) = - let frags = - List.map - (function - | Str.Text s -> Text s - | Str.Delim "%%" -> Text "%" - | Str.Delim s -> Param(int_of_string(String.sub s 1 (String.length s - 1)))) - (Str.full_split re_annot_param txt) in - let max_param = ref 0 in - List.iter - (function - | Text _ -> () - | Param n -> max_param := max n !max_param) - frags; - fprintf p " | \"%s\", " txt; - list_iteri - (fun i targ -> fprintf p "_x%d :: " (i + 1)) - targs; - fprintf p "nil =>@ "; - fprintf p " "; - List.iter - (function - | Text s -> fprintf p "%s" s - | Param n -> fprintf p "_x%d" n) - frags; - fprintf p "@ " - -let print_assertions p = - if !assertions <> [] then begin - fprintf p "Definition assertions (txt: string) args : Prop :=@ "; - fprintf p " match txt, args with@ "; - List.iter (print_assertion p) !assertions; - fprintf p " | _, _ => False@ "; - fprintf p " end.@ @ " - end - (* The prologue *) let prologue = "\ @@ -595,5 +545,4 @@ let print_program p prog sourcefile normalized = fprintf p "Definition prog : Clight.program := @ "; fprintf p " mkprogram composites global_definitions public_idents %a Logic.I.@ @ " ident prog.Ctypes.prog_main; - print_assertions p; fprintf p "@]@." diff --git a/test/clightgen/annotations.c b/test/clightgen/annotations.c new file mode 100644 index 00000000..56fc1700 --- /dev/null +++ b/test/clightgen/annotations.c @@ -0,0 +1,6 @@ +int f(int x, long y) +{ + __builtin_ais_annot("x is %e1, y is %e2", x, y); + __builtin_annot("x is %1, y is %2", x, y); + return __builtin_annot_intval("x was here: %1", x); +} -- cgit From caaaffd31f63f1239a2371f418ff448651752ff8 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 5 Jun 2020 17:15:21 +0200 Subject: Improve portability of the test for annotations inclightgen __builtin_ais_annot is not supported for macOS nor for Cygwin. --- test/clightgen/Makefile | 2 ++ test/clightgen/annotations.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/clightgen/Makefile b/test/clightgen/Makefile index 0607e2fa..bf4a044b 100644 --- a/test/clightgen/Makefile +++ b/test/clightgen/Makefile @@ -22,6 +22,8 @@ SRC+=aes.c almabench.c binarytrees.c bisect.c chomp.c fannkuch.c fft.c \ SRC+=arrays.c eval.c gmllexer.c gmlparser.c intersect.c light.c main.c \ matrix.c memory.c object.c render.c simplify.c surface.c vector.c +CFLAGS=-DSYSTEM_$(SYSTEM) + all: $(SRC:.c=.vo) test: diff --git a/test/clightgen/annotations.c b/test/clightgen/annotations.c index 56fc1700..e91c7fbc 100644 --- a/test/clightgen/annotations.c +++ b/test/clightgen/annotations.c @@ -1,6 +1,8 @@ int f(int x, long y) { +#if !defined(SYSTEM_macosx) && !defined(SYSTEM_cygwin) __builtin_ais_annot("x is %e1, y is %e2", x, y); +#endif __builtin_annot("x is %1, y is %2", x, y); return __builtin_annot_intval("x was here: %1", x); } -- cgit From 5e29f8b5ba9582ecf2a1d0baeaef195873640607 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 8 Jun 2020 12:33:52 +0200 Subject: Compatibility with coq 8.11.2 Updated configure script to also allow coq version 8.11.2 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index ee0108ae..d5264654 100755 --- a/configure +++ b/configure @@ -530,7 +530,7 @@ missingtools=false echo "Testing Coq... " | tr -d '\n' coq_ver=$(${COQBIN}coqc -v 2>/dev/null | sed -n -e 's/The Coq Proof Assistant, version \([^ ]*\).*$/\1/p') case "$coq_ver" in - 8.8.0|8.8.1|8.8.2|8.9.0|8.9.1|8.10.0|8.10.1|8.10.2|8.11.0|8.11.1) + 8.8.0|8.8.1|8.8.2|8.9.0|8.9.1|8.10.0|8.10.1|8.10.2|8.11.0|8.11.1|8.11.2) echo "version $coq_ver -- good!";; ?*) echo "version $coq_ver -- UNSUPPORTED" -- cgit From 070babeff47562a72d6a58dd70fc7ac1bcbf205c Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 15 Jun 2020 19:20:15 +0200 Subject: SimplExpr: better translation of casts in a "for effects" context This is useful for statements such as `(void) expr;` where we would prefer not to explicitly compute intermediate values of type `void` and store them in Clight temporary variables. See issue #361 for a real-world occurrence of this phenomenon. --- cfrontend/SimplExpr.v | 11 ++- cfrontend/SimplExprproof.v | 165 +++++++++++++++++++++++---------------------- cfrontend/SimplExprspec.v | 126 +++++++++++++++++++--------------- 3 files changed, 166 insertions(+), 136 deletions(-) diff --git a/cfrontend/SimplExpr.v b/cfrontend/SimplExpr.v index 7cdff468..1398317d 100644 --- a/cfrontend/SimplExpr.v +++ b/cfrontend/SimplExpr.v @@ -226,6 +226,8 @@ Definition sd_seqbool_val (tmp: ident) (ty: type) := SDbase type_bool ty tmp. Definition sd_seqbool_set (ty: type) (sd: set_destination) := let tmp := sd_temp sd in SDcons type_bool ty tmp sd. +Definition sd_cast_set (ty: type) (sd: set_destination) := + let tmp := sd_temp sd in SDcons ty ty tmp sd. Fixpoint transl_expr (dst: destination) (a: Csyntax.expr) : mon (list statement * expr) := match a with @@ -268,8 +270,13 @@ Fixpoint transl_expr (dst: destination) (a: Csyntax.expr) : mon (list statement do (sl2, a2) <- transl_expr For_val r2; ret (finish dst (sl1 ++ sl2) (Ebinop op a1 a2 ty)) | Csyntax.Ecast r1 ty => - do (sl1, a1) <- transl_expr For_val r1; - ret (finish dst sl1 (Ecast a1 ty)) + match dst with + | For_val | For_set _ => + do (sl1, a1) <- transl_expr For_val r1; + ret (finish dst sl1 (Ecast a1 ty)) + | For_effects => + transl_expr For_effects r1 + end | Csyntax.Eseqand r1 r2 ty => do (sl1, a1) <- transl_expr For_val r1; match dst with diff --git a/cfrontend/SimplExprproof.v b/cfrontend/SimplExprproof.v index ee1df409..9a3f32ec 100644 --- a/cfrontend/SimplExprproof.v +++ b/cfrontend/SimplExprproof.v @@ -145,18 +145,18 @@ Proof. assert (A: forall dst a, dst = For_val \/ dst = For_effects -> final dst a = nil). intros. destruct H; subst dst; auto. apply tr_expr_exprlist; intros; simpl in *; try discriminate; auto. - rewrite H0; auto. simpl; auto. - rewrite H0; auto. simpl; auto. - destruct H1; congruence. - destruct (andb_prop _ _ H6). inv H1. +- rewrite H0; auto. simpl; auto. +- rewrite H0; auto. simpl; auto. +- destruct H1; congruence. +- destruct (andb_prop _ _ H6). inv H1. rewrite H0; eauto. simpl; auto. unfold chunk_for_volatile_type in H9. destruct (type_is_volatile (Csyntax.typeof e1)); simpl in H8; congruence. - rewrite H0; auto. simpl; auto. - rewrite H0; auto. simpl; auto. - destruct (andb_prop _ _ H7). rewrite H0; auto. rewrite H2; auto. simpl; auto. - rewrite H0; auto. simpl; auto. - destruct (andb_prop _ _ H6). rewrite H0; auto. +- rewrite H0; auto. simpl; auto. +- rewrite H0; auto. simpl; auto. +- destruct (andb_prop _ _ H7). rewrite H0; auto. rewrite H2; auto. simpl; auto. +- rewrite H0; auto. simpl; auto. +- destruct (andb_prop _ _ H6). rewrite H0; auto. Qed. Lemma tr_simple_expr_nil: @@ -234,11 +234,11 @@ Proof. Opaque makeif. intros e m. apply (eval_simple_rvalue_lvalue_ind ge e m); intros until tmps; intros TR; inv TR. -(* value *) +- (* value *) auto. - auto. - exists a0; auto. -(* rvalof *) +- auto. +- exists a0; auto. +- (* rvalof *) inv H7; try congruence. exploit H0; eauto. intros [A [B C]]. subst sl1; simpl. @@ -248,53 +248,55 @@ Opaque makeif. exploit deref_loc_translated; eauto. unfold chunk_for_volatile_type; rewrite H2. tauto. destruct dst; auto. econstructor. split. simpl; eauto. auto. -(* addrof *) +- (* addrof *) exploit H0; eauto. intros [A [B C]]. subst sl1; simpl. assert (eval_expr tge e le m (Eaddrof' a1 ty) (Vptr b ofs)) by (apply eval_Eaddrof'; auto). assert (typeof (Eaddrof' a1 ty) = ty) by (apply typeof_Eaddrof'). destruct dst; auto. simpl; econstructor; eauto. -(* unop *) +- (* unop *) exploit H0; eauto. intros [A [B C]]. subst sl1; simpl. assert (eval_expr tge e le m (Eunop op a1 ty) v). econstructor; eauto. congruence. destruct dst; auto. simpl; econstructor; eauto. -(* binop *) +- (* binop *) exploit H0; eauto. intros [A [B C]]. exploit H2; eauto. intros [D [E F]]. subst sl1 sl2; simpl. assert (eval_expr tge e le m (Ebinop op a1 a2 ty) v). econstructor; eauto. rewrite comp_env_preserved; congruence. destruct dst; auto. simpl; econstructor; eauto. -(* cast *) +- (* cast effects *) + exploit H0; eauto. +- (* cast val *) exploit H0; eauto. intros [A [B C]]. subst sl1; simpl. assert (eval_expr tge e le m (Ecast a1 ty) v). econstructor; eauto. congruence. destruct dst; auto. simpl; econstructor; eauto. -(* sizeof *) +- (* sizeof *) rewrite <- comp_env_preserved. destruct dst. split; auto. split; auto. constructor. auto. exists (Esizeof ty1 ty). split. auto. split. auto. constructor. -(* alignof *) +- (* alignof *) rewrite <- comp_env_preserved. destruct dst. split; auto. split; auto. constructor. auto. exists (Ealignof ty1 ty). split. auto. split. auto. constructor. -(* var local *) +- (* var local *) split; auto. split; auto. apply eval_Evar_local; auto. -(* var global *) +- (* var global *) split; auto. split; auto. apply eval_Evar_global; auto. rewrite symbols_preserved; auto. -(* deref *) +- (* deref *) exploit H0; eauto. intros [A [B C]]. subst sl1. split; auto. split. rewrite typeof_Ederef'; auto. apply eval_Ederef'; auto. -(* field struct *) +- (* field struct *) rewrite <- comp_env_preserved in *. exploit H0; eauto. intros [A [B C]]. subst sl1. split; auto. split; auto. rewrite B in H1. eapply eval_Efield_struct; eauto. -(* field union *) +- (* field union *) rewrite <- comp_env_preserved in *. exploit H0; eauto. intros [A [B C]]. subst sl1. split; auto. split; auto. rewrite B in H1. eapply eval_Efield_union; eauto. @@ -408,43 +410,43 @@ Ltac UNCHANGED := (*generalize compat_dest_change; intro CDC.*) apply leftcontext_leftcontextlist_ind; intros. -(* base *) +- (* base *) TR. rewrite <- app_nil_end; auto. red; auto. intros. rewrite <- app_nil_end; auto. -(* deref *) +- (* deref *) inv H1. exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1; rewrite app_ass; eauto. auto. intros. rewrite <- app_ass. econstructor; eauto. -(* field *) +- (* field *) inv H1. exploit H0. eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1; rewrite app_ass; eauto. auto. intros. rewrite <- app_ass. econstructor; eauto. -(* rvalof *) +- (* rvalof *) inv H1. exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1; rewrite app_ass; eauto. red; eauto. intros. rewrite <- app_ass; econstructor; eauto. exploit typeof_context; eauto. congruence. -(* addrof *) +- (* addrof *) inv H1. exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1; rewrite app_ass; eauto. auto. intros. rewrite <- app_ass. econstructor; eauto. -(* unop *) +- (* unop *) inv H1. exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1; rewrite app_ass; eauto. auto. intros. rewrite <- app_ass. econstructor; eauto. -(* binop left *) +- (* binop left *) inv H1. exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1. rewrite app_ass. eauto. red; auto. intros. rewrite <- app_ass. econstructor; eauto. eapply tr_expr_invariant; eauto. UNCHANGED. -(* binop right *) +- (* binop right *) inv H2. assert (sl1 = nil) by (eapply tr_simple_expr_nil; eauto). subst sl1; simpl. exploit H1; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. @@ -452,14 +454,19 @@ Ltac UNCHANGED := red; auto. intros. rewrite <- app_ass. change (sl3 ++ sl2') with (nil ++ sl3 ++ sl2'). rewrite app_ass. econstructor; eauto. eapply tr_expr_invariant; eauto. UNCHANGED. -(* cast *) +- (* cast *) inv H1. ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. - TR. subst sl1; rewrite app_ass; eauto. auto. + TR. eauto. auto. + intros. econstructor; eauto. ++ (* generic *) + exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. + TR. subst sl1. rewrite app_ass. eauto. auto. intros. rewrite <- app_ass. econstructor; eauto. -(* seqand *) +- (* seqand *) inv H1. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. @@ -467,15 +474,15 @@ Ltac UNCHANGED := intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. auto. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. red; auto. intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_expr_invariant; eauto. UNCHANGED. - auto. auto. auto. auto. - (* for set *) + auto. auto. auto. ++ (* for set *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. @@ -483,9 +490,9 @@ Ltac UNCHANGED := intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. auto. -(* seqor *) +- (* seqor *) inv H1. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. @@ -493,15 +500,15 @@ Ltac UNCHANGED := intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. auto. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. red; auto. intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_expr_invariant; eauto. UNCHANGED. - auto. auto. auto. auto. - (* for set *) + auto. auto. auto. ++ (* for set *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. @@ -509,9 +516,9 @@ Ltac UNCHANGED := intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. auto. -(* condition *) +- (* condition *) inv H1. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. @@ -520,7 +527,7 @@ Ltac UNCHANGED := eapply tr_expr_invariant; eauto. UNCHANGED. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. auto. auto. auto. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. @@ -529,7 +536,7 @@ Ltac UNCHANGED := eapply tr_expr_invariant; eauto. UNCHANGED. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. auto. auto. - (* for set *) ++ (* for set *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. rewrite app_ass. eauto. @@ -538,16 +545,16 @@ Ltac UNCHANGED := eapply tr_expr_invariant; eauto. UNCHANGED. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. auto. auto. auto. -(* assign left *) +- (* assign left *) inv H1. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1. rewrite app_ass. eauto. red; auto. intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1. rewrite app_ass. eauto. red; auto. @@ -556,9 +563,9 @@ Ltac UNCHANGED := auto. auto. auto. auto. auto. auto. eapply typeof_context; eauto. auto. -(* assign right *) +- (* assign right *) inv H2. - (* for effects *) ++ (* for effects *) assert (sl1 = nil) by (eapply tr_simple_expr_nil; eauto). subst sl1; simpl. exploit H1; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl2. rewrite app_ass. eauto. @@ -567,7 +574,7 @@ Ltac UNCHANGED := econstructor. eapply tr_expr_invariant; eauto. UNCHANGED. apply S; auto. auto. auto. auto. - (* for val *) ++ (* for val *) assert (sl1 = nil) by (eapply tr_simple_expr_nil; eauto). subst sl1; simpl. exploit H1; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl2. rewrite app_ass. eauto. @@ -577,9 +584,9 @@ Ltac UNCHANGED := eapply tr_expr_invariant; eauto. UNCHANGED. apply S; auto. auto. auto. auto. auto. auto. auto. auto. eapply typeof_context; eauto. -(* assignop left *) +- (* assignop left *) inv H1. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1. rewrite app_ass. eauto. red; auto. @@ -587,7 +594,7 @@ Ltac UNCHANGED := eapply tr_expr_invariant; eauto. UNCHANGED. symmetry; eapply typeof_context; eauto. eauto. auto. auto. auto. auto. auto. auto. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1. rewrite app_ass. eauto. red; auto. @@ -595,9 +602,9 @@ Ltac UNCHANGED := eapply tr_expr_invariant; eauto. UNCHANGED. eauto. auto. auto. auto. auto. auto. auto. auto. auto. auto. auto. eapply typeof_context; eauto. -(* assignop right *) +- (* assignop right *) inv H2. - (* for effects *) ++ (* for effects *) assert (sl1 = nil) by (eapply tr_simple_expr_nil; eauto). subst sl1; simpl. exploit H1; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl2. rewrite app_ass. eauto. @@ -605,7 +612,7 @@ Ltac UNCHANGED := intros. rewrite <- app_ass. change (sl0 ++ sl2') with (nil ++ sl0 ++ sl2'). rewrite app_ass. econstructor. eapply tr_expr_invariant; eauto. UNCHANGED. apply S; auto. auto. eauto. auto. auto. auto. auto. auto. auto. - (* for val *) ++ (* for val *) assert (sl1 = nil) by (eapply tr_simple_expr_nil; eauto). subst sl1; simpl. exploit H1; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl2. rewrite app_ass. eauto. @@ -613,35 +620,35 @@ Ltac UNCHANGED := intros. rewrite <- app_ass. change (sl0 ++ sl2') with (nil ++ sl0 ++ sl2'). rewrite app_ass. econstructor. eapply tr_expr_invariant; eauto. UNCHANGED. apply S; auto. eauto. auto. auto. auto. auto. auto. auto. auto. auto. auto. auto. auto. -(* postincr *) +- (* postincr *) inv H1. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. red; auto. intros. rewrite <- app_ass. econstructor; eauto. symmetry; eapply typeof_context; eauto. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. red; auto. intros. rewrite <- app_ass. econstructor; eauto. eapply typeof_context; eauto. -(* call left *) +- (* call left *) inv H1. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. red; auto. intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_exprlist_invariant; eauto. UNCHANGED. auto. auto. auto. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. red; auto. intros. rewrite <- app_ass. econstructor. auto. apply S; auto. eapply tr_exprlist_invariant; eauto. UNCHANGED. auto. auto. auto. auto. -(* call right *) +- (* call right *) inv H2. - (* for effects *) ++ (* for effects *) assert (sl1 = nil) by (eapply tr_simple_expr_nil; eauto). subst sl1; simpl. exploit H1; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. @@ -650,7 +657,7 @@ Ltac UNCHANGED := intros. rewrite <- app_ass. change (sl3++sl2') with (nil ++ sl3 ++ sl2'). rewrite app_ass. econstructor. eapply tr_expr_invariant; eauto. UNCHANGED. apply S; auto. auto. auto. auto. - (* for val *) ++ (* for val *) assert (sl1 = nil) by (eapply tr_simple_expr_nil; eauto). subst sl1; simpl. exploit H1; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. @@ -660,42 +667,42 @@ Ltac UNCHANGED := auto. eapply tr_expr_invariant; eauto. UNCHANGED. apply S; auto. auto. auto. auto. auto. -(* builtin *) +- (* builtin *) inv H1. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. red; auto. intros. rewrite <- app_ass. change (sl3++sl2') with (nil ++ sl3 ++ sl2'). rewrite app_ass. econstructor. apply S; auto. auto. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. red; auto. intros. rewrite <- app_ass. change (sl3++sl2') with (nil ++ sl3 ++ sl2'). rewrite app_ass. econstructor. auto. apply S; auto. auto. auto. -(* comma *) +- (* comma *) inv H1. exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q; rewrite app_ass; eauto. red; auto. intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_expr_invariant; eauto. UNCHANGED. auto. auto. auto. -(* paren *) +- (* paren *) inv H1. - (* for val *) ++ (* for val *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. eauto. red; auto. intros. econstructor; eauto. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. eauto. auto. intros. econstructor; eauto. - (* for set *) ++ (* for set *) exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. rewrite Q. eauto. auto. intros. econstructor; eauto. -(* cons left *) +- (* cons left *) inv H1. exploit H0; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. TR. subst sl1. rewrite app_ass. eauto. @@ -703,7 +710,7 @@ Ltac UNCHANGED := intros. rewrite <- app_ass. econstructor. apply S; auto. eapply tr_exprlist_invariant; eauto. UNCHANGED. auto. auto. auto. -(* cons right *) +- (* cons right *) inv H2. assert (sl1 = nil) by (eapply tr_simple_expr_nil; eauto). subst sl1; simpl. exploit H1; eauto. intros [dst' [sl1' [sl2' [a' [tmp' [P [Q [R S]]]]]]]]. diff --git a/cfrontend/SimplExprspec.v b/cfrontend/SimplExprspec.v index e7d57a1c..98425311 100644 --- a/cfrontend/SimplExprspec.v +++ b/cfrontend/SimplExprspec.v @@ -108,7 +108,12 @@ Inductive tr_expr: temp_env -> destination -> Csyntax.expr -> list statement -> tr_expr le dst (Csyntax.Ebinop op e1 e2 ty) (sl1 ++ sl2 ++ final dst (Ebinop op a1 a2 ty)) (Ebinop op a1 a2 ty) tmp - | tr_cast: forall le dst e1 ty sl1 a1 tmp, + | tr_cast_effects: forall le e1 ty sl1 a1 any tmp, + tr_expr le For_effects e1 sl1 a1 tmp -> + tr_expr le For_effects (Csyntax.Ecast e1 ty) + sl1 + any tmp + | tr_cast_val: forall le dst e1 ty sl1 a1 tmp, tr_expr le For_val e1 sl1 a1 tmp -> tr_expr le dst (Csyntax.Ecast e1 ty) (sl1 ++ final dst (Ecast a1 ty)) @@ -767,58 +772,69 @@ Lemma transl_meets_spec: exists tmps, (forall le, tr_exprlist le rl sl al tmps) /\ contained tmps g g'). Proof. apply expr_exprlist_ind; simpl add_dest; intros. -(* val *) +- (* val *) simpl in H. destruct v; monadInv H; exists (@nil ident); split; auto with gensym. Opaque makeif. - intros. destruct dst; simpl in *; inv H2. ++ intros. destruct dst; simpl in *; inv H2. constructor. auto. intros; constructor. constructor. constructor. auto. intros; constructor. - intros. destruct dst; simpl in *; inv H2. ++ intros. destruct dst; simpl in *; inv H2. constructor. auto. intros; constructor. constructor. constructor. auto. intros; constructor. - intros. destruct dst; simpl in *; inv H2. ++ intros. destruct dst; simpl in *; inv H2. constructor. auto. intros; constructor. constructor. constructor. auto. intros; constructor. - intros. destruct dst; simpl in *; inv H2. ++ intros. destruct dst; simpl in *; inv H2. constructor. auto. intros; constructor. constructor. constructor. auto. intros; constructor. -(* var *) +- (* var *) monadInv H; econstructor; split; auto with gensym. UseFinish. constructor. -(* field *) +- (* field *) monadInv H0. exploit H; eauto. auto. intros [tmp [A B]]. UseFinish. econstructor; split; eauto. intros; apply tr_expr_add_dest. constructor; auto. -(* valof *) +- (* valof *) monadInv H0. exploit H; eauto. intros [tmp1 [A B]]. exploit transl_valof_meets_spec; eauto. intros [tmp2 [Csyntax D]]. UseFinish. exists (tmp1 ++ tmp2); split. intros; apply tr_expr_add_dest. econstructor; eauto with gensym. eauto with gensym. -(* deref *) +- (* deref *) monadInv H0. exploit H; eauto. intros [tmp [A B]]. UseFinish. econstructor; split; eauto. intros; apply tr_expr_add_dest. constructor; auto. -(* addrof *) +- (* addrof *) monadInv H0. exploit H; eauto. intros [tmp [A B]]. UseFinish. econstructor; split; eauto. intros; apply tr_expr_add_dest. econstructor; eauto. -(* unop *) +- (* unop *) monadInv H0. exploit H; eauto. intros [tmp [A B]]. UseFinish. econstructor; split; eauto. intros; apply tr_expr_add_dest. constructor; auto. -(* binop *) +- (* binop *) monadInv H1. exploit H; eauto. intros [tmp1 [A B]]. exploit H0; eauto. intros [tmp2 [Csyntax D]]. UseFinish. exists (tmp1 ++ tmp2); split. intros; apply tr_expr_add_dest. econstructor; eauto with gensym. eauto with gensym. -(* cast *) - monadInv H0. exploit H; eauto. intros [tmp [A B]]. UseFinish. - econstructor; split; eauto. intros; apply tr_expr_add_dest. constructor; auto. -(* seqand *) +- (* cast *) + destruct dst. ++ (* for value *) + monadInv H0. exploit H; eauto. intros [tmp [A B]]. + econstructor; split; eauto. intros; apply tr_expr_add_dest. + rewrite (app_nil_end sl). + apply tr_cast_val with (dst := For_val); auto. ++ (* for effects *) + exploit H; eauto. intros [tmp [A B]]. + econstructor; split; eauto. intros; eapply tr_cast_effects; eauto. ++ (* for set *) + monadInv H0. exploit H; eauto. intros [tmp [A B]]. + econstructor; split; eauto. intros; apply tr_expr_add_dest. + apply tr_cast_val with (dst := For_set sd); auto. +- (* seqand *) monadInv H1. exploit H; eauto. intros [tmp1 [A B]]. destruct dst; monadInv EQ0. - (* for value *) ++ (* for value *) exploit H0; eauto with gensym. intros [tmp2 [C D]]. simpl add_dest in *. exists (x0 :: tmp1 ++ tmp2); split. @@ -826,23 +842,23 @@ Opaque makeif. apply list_disjoint_cons_r; eauto with gensym. apply contained_cons. eauto with gensym. apply contained_app; eauto with gensym. - (* for effects *) ++ (* for effects *) exploit H0; eauto with gensym. intros [tmp2 [Csyntax D]]. simpl add_dest in *. exists (tmp1 ++ tmp2); split. intros; eapply tr_seqand_effects; eauto with gensym. apply contained_app; eauto with gensym. - (* for set *) ++ (* for set *) exploit H0; eauto with gensym. intros [tmp2 [C D]]. simpl add_dest in *. exists (tmp1 ++ tmp2); split. intros; eapply tr_seqand_set; eauto with gensym. apply list_disjoint_cons_r; eauto with gensym. apply contained_app; eauto with gensym. -(* seqor *) +- (* seqor *) monadInv H1. exploit H; eauto. intros [tmp1 [A B]]. destruct dst; monadInv EQ0. - (* for value *) ++ (* for value *) exploit H0; eauto with gensym. intros [tmp2 [Csyntax D]]. simpl add_dest in *. exists (x0 :: tmp1 ++ tmp2); split. @@ -850,23 +866,23 @@ Opaque makeif. apply list_disjoint_cons_r; eauto with gensym. apply contained_cons. eauto with gensym. apply contained_app; eauto with gensym. - (* for effects *) ++ (* for effects *) exploit H0; eauto with gensym. intros [tmp2 [C D]]. simpl add_dest in *. exists (tmp1 ++ tmp2); split. intros; eapply tr_seqor_effects; eauto with gensym. apply contained_app; eauto with gensym. - (* for set *) ++ (* for set *) exploit H0; eauto with gensym. intros [tmp2 [C D]]. simpl add_dest in *. exists (tmp1 ++ tmp2); split. intros; eapply tr_seqor_set; eauto with gensym. apply list_disjoint_cons_r; eauto with gensym. apply contained_app; eauto with gensym. -(* condition *) +- (* condition *) monadInv H2. exploit H; eauto. intros [tmp1 [A B]]. destruct dst; monadInv EQ0. - (* for value *) ++ (* for value *) exploit H0; eauto with gensym. intros [tmp2 [C D]]. exploit H1; eauto with gensym. intros [tmp3 [E F]]. simpl add_dest in *. @@ -877,14 +893,14 @@ Opaque makeif. apply contained_cons. eauto with gensym. apply contained_app. eauto with gensym. apply contained_app; eauto with gensym. - (* for effects *) ++ (* for effects *) exploit H0; eauto. intros [tmp2 [Csyntax D]]. exploit H1; eauto. intros [tmp3 [E F]]. simpl add_dest in *. exists (tmp1 ++ tmp2 ++ tmp3); split. intros; eapply tr_condition_effects; eauto with gensym. apply contained_app; eauto with gensym. - (* for test *) ++ (* for test *) exploit H0; eauto with gensym. intros [tmp2 [C D]]. exploit H1; eauto 10 with gensym. intros [tmp3 [E F]]. simpl add_dest in *. @@ -895,69 +911,69 @@ Opaque makeif. apply contained_cons; eauto with gensym. apply contained_app; eauto with gensym. apply contained_app; eauto with gensym. -(* sizeof *) +- (* sizeof *) monadInv H. UseFinish. exists (@nil ident); split; auto with gensym. constructor. -(* alignof *) +- (* alignof *) monadInv H. UseFinish. exists (@nil ident); split; auto with gensym. constructor. -(* assign *) +- (* assign *) monadInv H1. exploit H; eauto. intros [tmp1 [A B]]. exploit H0; eauto. intros [tmp2 [Csyntax D]]. destruct dst; monadInv EQ2; simpl add_dest in *. - (* for value *) ++ (* for value *) exists (x1 :: tmp1 ++ tmp2); split. intros. eapply tr_assign_val with (dst := For_val); eauto with gensym. apply contained_cons. eauto with gensym. apply contained_app; eauto with gensym. - (* for effects *) ++ (* for effects *) exists (tmp1 ++ tmp2); split. econstructor; eauto with gensym. apply contained_app; eauto with gensym. - (* for set *) ++ (* for set *) exists (x1 :: tmp1 ++ tmp2); split. repeat rewrite app_ass. simpl. intros. eapply tr_assign_val with (dst := For_set sd); eauto with gensym. apply contained_cons. eauto with gensym. apply contained_app; eauto with gensym. -(* assignop *) +- (* assignop *) monadInv H1. exploit H; eauto. intros [tmp1 [A B]]. exploit H0; eauto. intros [tmp2 [Csyntax D]]. exploit transl_valof_meets_spec; eauto. intros [tmp3 [E F]]. destruct dst; monadInv EQ3; simpl add_dest in *. - (* for value *) ++ (* for value *) exists (x2 :: tmp1 ++ tmp2 ++ tmp3); split. intros. eapply tr_assignop_val with (dst := For_val); eauto with gensym. apply contained_cons. eauto with gensym. apply contained_app; eauto with gensym. - (* for effects *) ++ (* for effects *) exists (tmp1 ++ tmp2 ++ tmp3); split. econstructor; eauto with gensym. apply contained_app; eauto with gensym. - (* for set *) ++ (* for set *) exists (x2 :: tmp1 ++ tmp2 ++ tmp3); split. repeat rewrite app_ass. simpl. intros. eapply tr_assignop_val with (dst := For_set sd); eauto with gensym. apply contained_cons. eauto with gensym. apply contained_app; eauto with gensym. -(* postincr *) +- (* postincr *) monadInv H0. exploit H; eauto. intros [tmp1 [A B]]. destruct dst; monadInv EQ0; simpl add_dest in *. - (* for value *) ++ (* for value *) exists (x0 :: tmp1); split. econstructor; eauto with gensym. apply contained_cons; eauto with gensym. - (* for effects *) ++ (* for effects *) exploit transl_valof_meets_spec; eauto. intros [tmp2 [Csyntax D]]. exists (tmp1 ++ tmp2); split. econstructor; eauto with gensym. eauto with gensym. - (* for set *) ++ (* for set *) repeat rewrite app_ass; simpl. exists (x0 :: tmp1); split. econstructor; eauto with gensym. apply contained_cons; eauto with gensym. -(* comma *) +- (* comma *) monadInv H1. exploit H; eauto. intros [tmp1 [A B]]. exploit H0; eauto with gensym. intros [tmp2 [Csyntax D]]. exists (tmp1 ++ tmp2); split. @@ -967,46 +983,46 @@ Opaque makeif. simpl. eapply incl_tran. 2: apply add_dest_incl. auto with gensym. destruct dst; simpl; auto with gensym. apply contained_app; eauto with gensym. -(* call *) +- (* call *) monadInv H1. exploit H; eauto. intros [tmp1 [A B]]. exploit H0; eauto. intros [tmp2 [Csyntax D]]. destruct dst; monadInv EQ2; simpl add_dest in *. - (* for value *) ++ (* for value *) exists (x1 :: tmp1 ++ tmp2); split. econstructor; eauto with gensym. congruence. apply contained_cons. eauto with gensym. apply contained_app; eauto with gensym. - (* for effects *) ++ (* for effects *) exists (tmp1 ++ tmp2); split. econstructor; eauto with gensym. apply contained_app; eauto with gensym. - (* for set *) ++ (* for set *) exists (x1 :: tmp1 ++ tmp2); split. repeat rewrite app_ass. econstructor; eauto with gensym. congruence. apply contained_cons. eauto with gensym. apply contained_app; eauto with gensym. -(* builtin *) +- (* builtin *) monadInv H0. exploit H; eauto. intros [tmp1 [A B]]. destruct dst; monadInv EQ0; simpl add_dest in *. - (* for value *) ++ (* for value *) exists (x0 :: tmp1); split. econstructor; eauto with gensym. congruence. apply contained_cons; eauto with gensym. - (* for effects *) ++ (* for effects *) exists tmp1; split. econstructor; eauto with gensym. auto. - (* for set *) ++ (* for set *) exists (x0 :: tmp1); split. repeat rewrite app_ass. econstructor; eauto with gensym. congruence. apply contained_cons; eauto with gensym. -(* loc *) +- (* loc *) monadInv H. -(* paren *) +- (* paren *) monadInv H0. -(* nil *) +- (* nil *) monadInv H; exists (@nil ident); split; auto with gensym. constructor. -(* cons *) +- (* cons *) monadInv H1. exploit H; eauto. intros [tmp1 [A B]]. exploit H0; eauto. intros [tmp2 [Csyntax D]]. exists (tmp1 ++ tmp2); split. -- cgit From 375c844efb8b91d4ff1dce08ed25f55ddef231d7 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 15 Jun 2020 19:49:07 +0200 Subject: SimplExpr: remove unused definition "sd_cast_set" Follow-up to commit 070babef. --- cfrontend/SimplExpr.v | 2 -- 1 file changed, 2 deletions(-) diff --git a/cfrontend/SimplExpr.v b/cfrontend/SimplExpr.v index 1398317d..c7e57a54 100644 --- a/cfrontend/SimplExpr.v +++ b/cfrontend/SimplExpr.v @@ -226,8 +226,6 @@ Definition sd_seqbool_val (tmp: ident) (ty: type) := SDbase type_bool ty tmp. Definition sd_seqbool_set (ty: type) (sd: set_destination) := let tmp := sd_temp sd in SDcons type_bool ty tmp sd. -Definition sd_cast_set (ty: type) (sd: set_destination) := - let tmp := sd_temp sd in SDcons ty ty tmp sd. Fixpoint transl_expr (dst: destination) (a: Csyntax.expr) : mon (list statement * expr) := match a with -- cgit From 70609c932e066ffab0d2e3a2a38d66e834399532 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sun, 21 Jun 2020 19:14:32 +0200 Subject: Transform non-recursive Fixpoint into Definition As detected by the new warning in Coq 8.12. The use of Fixpoint here is not warranted and either an oversight or a leftover from an earlier version. --- backend/Debugvar.v | 2 +- backend/NeedDomain.v | 2 +- common/AST.v | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/Debugvar.v b/backend/Debugvar.v index 1f361030..3204dae5 100644 --- a/backend/Debugvar.v +++ b/backend/Debugvar.v @@ -92,7 +92,7 @@ Fixpoint remove_state (v: ident) (s: avail) : avail := end end. -Fixpoint set_debug_info (v: ident) (info: list (builtin_arg loc)) (s: avail) := +Definition set_debug_info (v: ident) (info: list (builtin_arg loc)) (s: avail) := match normalize_debug info with | Some a => set_state v a s | None => remove_state v s diff --git a/backend/NeedDomain.v b/backend/NeedDomain.v index 3c2d8e20..d9e9e025 100644 --- a/backend/NeedDomain.v +++ b/backend/NeedDomain.v @@ -47,7 +47,7 @@ Definition iagree (p q mask: int) : Prop := forall i, 0 <= i < Int.zwordsize -> Int.testbit mask i = true -> Int.testbit p i = Int.testbit q i. -Fixpoint vagree (v w: val) (x: nval) {struct x}: Prop := +Definition vagree (v w: val) (x: nval) : Prop := match x with | Nothing => True | I m => diff --git a/common/AST.v b/common/AST.v index fcbf0b34..ddd10ede 100644 --- a/common/AST.v +++ b/common/AST.v @@ -105,7 +105,7 @@ Lemma rettype_eq: forall (t1 t2: rettype), {t1=t2} + {t1<>t2}. Proof. generalize typ_eq; decide equality. Defined. Global Opaque rettype_eq. -Fixpoint proj_rettype (r: rettype) : typ := +Definition proj_rettype (r: rettype) : typ := match r with | Tret t => t | Tint8signed | Tint8unsigned | Tint16signed | Tint16unsigned => Tint -- cgit From 5b8578daeed73483b130618c954abb24afa8ddb9 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sun, 21 Jun 2020 19:19:49 +0200 Subject: Preliminary support for Coq 8.12 Based on testing with beta-1 release. The deprecation warning about the "omega" tactic is ignored while we decide when to switch to "lia" instead. --- Makefile | 2 +- configure | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index df5fb03f..d91c5f37 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ RECDIRS=lib common $(ARCHDIRS) backend cfrontend driver flocq exportclight \ COQINCLUDES=$(foreach d, $(RECDIRS), -R $(d) compcert.$(d)) -COQCOPTS ?= -w -undeclared-scope +COQCOPTS ?= -w -undeclared-scope -w -omega-is-deprecated COQC="$(COQBIN)coqc" -q $(COQINCLUDES) $(COQCOPTS) COQDEP="$(COQBIN)coqdep" $(COQINCLUDES) COQDOC="$(COQBIN)coqdoc" diff --git a/configure b/configure index d5264654..b358f3cb 100755 --- a/configure +++ b/configure @@ -530,19 +530,19 @@ missingtools=false echo "Testing Coq... " | tr -d '\n' coq_ver=$(${COQBIN}coqc -v 2>/dev/null | sed -n -e 's/The Coq Proof Assistant, version \([^ ]*\).*$/\1/p') case "$coq_ver" in - 8.8.0|8.8.1|8.8.2|8.9.0|8.9.1|8.10.0|8.10.1|8.10.2|8.11.0|8.11.1|8.11.2) + 8.8.0|8.8.1|8.8.2|8.9.0|8.9.1|8.10.0|8.10.1|8.10.2|8.11.0|8.11.1|8.11.2|8.12.0) echo "version $coq_ver -- good!";; ?*) echo "version $coq_ver -- UNSUPPORTED" if $ignore_coq_version; then echo "Warning: this version of Coq is unsupported, proceed at your own risks." else - echo "Error: CompCert requires one of the following Coq versions: 8.11.1, 8.11.0, 8.10.2, 8.10.1, 8.10.0, 8.9.1, 8.9.0, 8.8.2, 8.8.1, 8.8.0" + echo "Error: CompCert requires a version of Coq between 8.8.0 and 8.12.0" missingtools=true fi;; "") echo "NOT FOUND" - echo "Error: make sure Coq version 8.9.1 is installed." + echo "Error: make sure Coq version 8.11.2 is installed." missingtools=true;; esac -- cgit From c6b86fd5719388301295f9ab4b07b57653e0d8c6 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Thu, 25 Jun 2020 11:21:00 +0200 Subject: Improve printing of builtin function invocations In particular __builtin_sel. --- cfrontend/PrintCsyntax.ml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cfrontend/PrintCsyntax.ml b/cfrontend/PrintCsyntax.ml index 03dc5837..97a00b09 100644 --- a/cfrontend/PrintCsyntax.ml +++ b/cfrontend/PrintCsyntax.ml @@ -268,6 +268,9 @@ let rec expr p (prec, e) = | Ebuiltin(EF_debug(kind,txt,_),_,args,_) -> fprintf p "__builtin_debug@[(%d,%S%a)@]" (P.to_int kind) (extern_atom txt) exprlist (false,args) + | Ebuiltin(EF_builtin(name, _), _, args, _) -> + fprintf p "%s@[(%a)@]" + (camlstring_of_coqstring name) exprlist (true, args) | Ebuiltin(_, _, args, _) -> fprintf p "@[(%a)@]" exprlist (true, args) | Eparen(a1, tycast, ty) -> -- cgit From 7fe7aabe4bac5a2250f31045797fce663ec65848 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Thu, 25 Jun 2020 11:21:31 +0200 Subject: Eliminate known builtins whose result is ignored A typical example is `(void) __builtin_sel(a, b, c)`. It is safe to generate zero code for these uses of builtins because builtins whose semantics are known to the compiler are pure. Other builtins with side effects (e.g. `__builtin_trap`) are not known and will remain in the compiled code. It is useful to generate zero code for these uses of builtins because some of them (e.g. `__builtin_sel`) must be transformed into proper CminorSel expressions during instruction selection. Otherwise, they propagate all the way to ExpandAsm, causing a "not implemented" error there. --- backend/Selection.v | 21 ++++++++++---- backend/Selectionproof.v | 73 ++++++++++++++++++++++++++---------------------- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/backend/Selection.v b/backend/Selection.v index c9771d99..480b09a2 100644 --- a/backend/Selection.v +++ b/backend/Selection.v @@ -252,6 +252,10 @@ Function sel_known_builtin (bf: builtin_function) (args: exprlist) := None end. +(** A CminorSel statement that does nothing, like [Sskip], but reduces. *) + +Definition Sno_op := Sseq Sskip Sskip. + (** Builtin functions in general *) Definition sel_builtin_default (optid: option ident) (ef: external_function) @@ -261,17 +265,22 @@ Definition sel_builtin_default (optid: option ident) (ef: external_function) Definition sel_builtin (optid: option ident) (ef: external_function) (args: list Cminor.expr) := - match optid, ef with - | Some id, EF_builtin name sg => + match ef with + | EF_builtin name sg => match lookup_builtin_function name sg with | Some bf => - match sel_known_builtin bf (sel_exprlist args) with - | Some a => Sassign id a - | None => sel_builtin_default optid ef args + match optid with + | Some id => + match sel_known_builtin bf (sel_exprlist args) with + | Some a => Sassign id a + | None => sel_builtin_default optid ef args + end + | None => + Sno_op (**r builtins with semantics are pure *) end | None => sel_builtin_default optid ef args end - | _, _ => + | _ => sel_builtin_default optid ef args end. diff --git a/backend/Selectionproof.v b/backend/Selectionproof.v index 8a3aaae6..a66bcf81 100644 --- a/backend/Selectionproof.v +++ b/backend/Selectionproof.v @@ -843,8 +843,8 @@ Lemma sel_builtin_default_correct: external_call ef ge vl m1 t v m2 -> env_lessdef e1 e1' -> Mem.extends m1 m1' -> exists e2' m2', - step tge (State f (sel_builtin_default optid ef al) k sp e1' m1') - t (State f Sskip k sp e2' m2') + plus step tge (State f (sel_builtin_default optid ef al) k sp e1' m1') + t (State f Sskip k sp e2' m2') /\ env_lessdef (set_optvar optid v e1) e2' /\ Mem.extends m2 m2'. Proof. @@ -852,6 +852,7 @@ Proof. exploit sel_builtin_args_correct; eauto. intros (vl' & A & B). exploit external_call_mem_extends; eauto. intros (v' & m2' & D & E & F & _). econstructor; exists m2'; split. + apply plus_one. econstructor. eexact A. eapply external_call_symbols_preserved. eexact senv_preserved. eexact D. split; auto. apply sel_builtin_res_correct; auto. Qed. @@ -862,8 +863,8 @@ Lemma sel_builtin_correct: external_call ef ge vl m1 t v m2 -> env_lessdef e1 e1' -> Mem.extends m1 m1' -> exists e2' m2', - step tge (State f (sel_builtin optid ef al) k sp e1' m1') - t (State f Sskip k sp e2' m2') + plus step tge (State f (sel_builtin optid ef al) k sp e1' m1') + t (State f Sskip k sp e2' m2') /\ env_lessdef (set_optvar optid v e1) e2' /\ Mem.extends m2 m2'. Proof. @@ -871,15 +872,18 @@ Proof. exploit sel_exprlist_correct; eauto. intros (vl' & A & B). exploit external_call_mem_extends; eauto. intros (v' & m2' & D & E & F & _). unfold sel_builtin. - destruct optid as [id|]; eauto using sel_builtin_default_correct. destruct ef; eauto using sel_builtin_default_correct. destruct (lookup_builtin_function name sg) as [bf|] eqn:LKUP; eauto using sel_builtin_default_correct. - destruct (sel_known_builtin bf (sel_exprlist al)) as [a|] eqn:SKB; eauto using sel_builtin_default_correct. simpl in D. red in D. rewrite LKUP in D. inv D. + destruct optid as [id|]; eauto using sel_builtin_default_correct. +- destruct (sel_known_builtin bf (sel_exprlist al)) as [a|] eqn:SKB; eauto using sel_builtin_default_correct. exploit eval_sel_known_builtin; eauto. intros (v'' & U & V). econstructor; exists m2'; split. - econstructor. eexact U. + apply plus_one. econstructor. eexact U. split; auto. apply set_var_lessdef; auto. apply Val.lessdef_trans with v'; auto. +- exists e1', m2'; split. + eapply plus_two. constructor. constructor. auto. + simpl; auto. Qed. (** If-conversion *) @@ -1170,8 +1174,8 @@ Remark sel_builtin_nolabel: forall (hf: helper_functions) optid ef args, nolabel' (sel_builtin optid ef args). Proof. unfold sel_builtin; intros; red; intros. - destruct optid; auto. destruct ef; auto. destruct lookup_builtin_function; auto. - destruct sel_known_builtin; auto. + destruct ef; auto. destruct lookup_builtin_function; auto. + destruct optid; auto. destruct sel_known_builtin; auto. Qed. Remark find_label_commut: @@ -1234,34 +1238,34 @@ Definition measure (s: Cminor.state) : nat := Lemma sel_step_correct: forall S1 t S2, Cminor.step ge S1 t S2 -> forall T1, match_states S1 T1 -> wt_state S1 -> - (exists T2, step tge T1 t T2 /\ match_states S2 T2) + (exists T2, plus step tge T1 t T2 /\ match_states S2 T2) \/ (measure S2 < measure S1 /\ t = E0 /\ match_states S2 T1)%nat \/ (exists S3 T2, star Cminor.step ge S2 E0 S3 /\ step tge T1 t T2 /\ match_states S3 T2). Proof. induction 1; intros T1 ME WTS; inv ME; try (monadInv TS). - (* skip seq *) - inv MC. left; econstructor; split. econstructor. econstructor; eauto. + inv MC. left; econstructor; split. apply plus_one; econstructor. econstructor; eauto. inv H. - (* skip block *) - inv MC. left; econstructor; split. econstructor. econstructor; eauto. + inv MC. left; econstructor; split. apply plus_one; econstructor. econstructor; eauto. inv H. - (* skip call *) exploit Mem.free_parallel_extends; eauto. intros [m2' [A B]]. left; econstructor; split. - econstructor. eapply match_is_call_cont; eauto. + apply plus_one; econstructor. eapply match_is_call_cont; eauto. erewrite stackspace_function_translated; eauto. econstructor; eauto. eapply match_is_call_cont; eauto. - (* assign *) exploit sel_expr_correct; eauto. intros [v' [A B]]. left; econstructor; split. - econstructor; eauto. + apply plus_one; econstructor; eauto. econstructor; eauto. apply set_var_lessdef; auto. - (* store *) exploit sel_expr_correct. try apply LINK. try apply HF. eexact H. eauto. eauto. intros [vaddr' [A B]]. exploit sel_expr_correct. try apply LINK. try apply HF. eexact H0. eauto. eauto. intros [v' [C D]]. exploit Mem.storev_extends; eauto. intros [m2' [P Q]]. left; econstructor; split. - eapply eval_store; eauto. + apply plus_one; eapply eval_store; eauto. econstructor; eauto. - (* Scall *) exploit classify_call_correct; eauto. @@ -1271,7 +1275,7 @@ Proof. exploit sel_exprlist_correct; eauto. intros [vargs' [C D]]. exploit functions_translated; eauto. intros (cunit' & fd' & U & V & W). left; econstructor; split. - econstructor; eauto. econstructor; eauto. + apply plus_one; econstructor; eauto. econstructor; eauto. eapply sig_function_translated; eauto. eapply match_callstate with (cunit := cunit'); eauto. eapply match_cont_call with (cunit := cunit) (hf := hf); eauto. @@ -1280,7 +1284,7 @@ Proof. exploit sel_exprlist_correct; eauto. intros [vargs' [C D]]. exploit functions_translated; eauto. intros (cunit' & fd' & X & Y & Z). left; econstructor; split. - econstructor; eauto. + apply plus_one; econstructor; eauto. subst vf. econstructor; eauto. rewrite symbols_preserved; eauto. eapply sig_function_translated; eauto. eapply match_callstate with (cunit := cunit'); eauto. @@ -1295,6 +1299,7 @@ Proof. exploit sel_exprlist_correct; eauto. intros [vargs' [C D]]. exploit functions_translated; eauto. intros (cunit' & fd' & E & F & G). left; econstructor; split. + apply plus_one. exploit classify_call_correct. eexact LINK. eauto. eauto. destruct (classify_call (prog_defmap cunit)) as [ | id | ef]; intros. econstructor; eauto. econstructor; eauto. eapply sig_function_translated; eauto. @@ -1308,7 +1313,7 @@ Proof. left; econstructor; split. eexact P. econstructor; eauto. - (* Seq *) left; econstructor; split. - constructor. + apply plus_one; constructor. econstructor; eauto. constructor; auto. - (* Sifthenelse *) simpl in TS. destruct (if_conversion (known_id f) env a s1 s2) as [s|] eqn:IFC; monadInv TS. @@ -1320,21 +1325,21 @@ Proof. + exploit sel_expr_correct; eauto. intros [v' [A B]]. assert (Val.bool_of_val v' b). inv B. auto. inv H0. left; exists (State f' (if b then x else x0) k' sp e' m'); split. - econstructor; eauto. eapply eval_condexpr_of_expr; eauto. + apply plus_one; econstructor; eauto. eapply eval_condexpr_of_expr; eauto. econstructor; eauto. destruct b; auto. - (* Sloop *) - left; econstructor; split. constructor. econstructor; eauto. + left; econstructor; split. apply plus_one; constructor. econstructor; eauto. constructor; auto. simpl; rewrite EQ; auto. - (* Sblock *) - left; econstructor; split. constructor. econstructor; eauto. constructor; auto. + left; econstructor; split. apply plus_one; constructor. econstructor; eauto. constructor; auto. - (* Sexit seq *) - inv MC. left; econstructor; split. constructor. econstructor; eauto. + inv MC. left; econstructor; split. apply plus_one; constructor. econstructor; eauto. inv H. - (* Sexit0 block *) - inv MC. left; econstructor; split. constructor. econstructor; eauto. + inv MC. left; econstructor; split. apply plus_one; constructor. econstructor; eauto. inv H. - (* SexitS block *) - inv MC. left; econstructor; split. constructor. econstructor; eauto. + inv MC. left; econstructor; split. apply plus_one; constructor. econstructor; eauto. inv H. - (* Sswitch *) inv H0; simpl in TS. @@ -1342,29 +1347,29 @@ Proof. destruct (validate_switch Int.modulus default cases ct) eqn:VALID; inv TS. exploit sel_expr_correct; eauto. intros [v' [A B]]. inv B. left; econstructor; split. - econstructor. eapply sel_switch_int_correct; eauto. + apply plus_one; econstructor. eapply sel_switch_int_correct; eauto. econstructor; eauto. + set (ct := compile_switch Int64.modulus default cases) in *. destruct (validate_switch Int64.modulus default cases ct) eqn:VALID; inv TS. exploit sel_expr_correct; eauto. intros [v' [A B]]. inv B. left; econstructor; split. - econstructor. eapply sel_switch_long_correct; eauto. + apply plus_one; econstructor. eapply sel_switch_long_correct; eauto. econstructor; eauto. - (* Sreturn None *) exploit Mem.free_parallel_extends; eauto. intros [m2' [P Q]]. erewrite <- stackspace_function_translated in P by eauto. left; econstructor; split. - econstructor. simpl; eauto. + apply plus_one; econstructor. simpl; eauto. econstructor; eauto. eapply call_cont_commut; eauto. - (* Sreturn Some *) exploit Mem.free_parallel_extends; eauto. intros [m2' [P Q]]. erewrite <- stackspace_function_translated in P by eauto. exploit sel_expr_correct; eauto. intros [v' [A B]]. left; econstructor; split. - econstructor; eauto. + apply plus_one; econstructor; eauto. econstructor; eauto. eapply call_cont_commut; eauto. - (* Slabel *) - left; econstructor; split. constructor. econstructor; eauto. + left; econstructor; split. apply plus_one; constructor. econstructor; eauto. - (* Sgoto *) assert (sel_stmt (prog_defmap cunit) (known_id f) env (Cminor.fn_body f) = OK (fn_body f')). { monadInv TF; simpl. congruence. } @@ -1375,7 +1380,7 @@ Proof. as [[s'' k'']|] eqn:?; intros; try contradiction. destruct H1. left; econstructor; split. - econstructor; eauto. + apply plus_one; econstructor; eauto. econstructor; eauto. - (* internal function *) destruct TF as (hf & HF & TF). @@ -1383,7 +1388,7 @@ Proof. exploit Mem.alloc_extends. eauto. eauto. apply Z.le_refl. apply Z.le_refl. intros [m2' [A B]]. left; econstructor; split. - econstructor; simpl; eauto. + apply plus_one; econstructor; simpl; eauto. econstructor; simpl; eauto. apply match_cont_other; auto. apply set_locals_lessdef. apply set_params_lessdef; auto. @@ -1393,7 +1398,7 @@ Proof. exploit external_call_mem_extends; eauto. intros [vres' [m2 [A [B [C D]]]]]. left; econstructor; split. - econstructor. eapply external_call_symbols_preserved; eauto. apply senv_preserved. + apply plus_one; econstructor. eapply external_call_symbols_preserved; eauto. apply senv_preserved. econstructor; eauto. - (* external call turned into a Sbuiltin *) exploit sel_builtin_correct; eauto. intros (e2' & m2' & P & Q & R). @@ -1401,7 +1406,7 @@ Proof. - (* return *) inv MC. left; econstructor; split. - econstructor. + apply plus_one; econstructor. econstructor; eauto. destruct optid; simpl; auto. apply set_var_lessdef; auto. - (* return of an external call turned into a Sbuiltin *) right; left; split. simpl; omega. split. auto. econstructor; eauto. @@ -1444,7 +1449,7 @@ Proof. unfold MS. exploit sel_step_correct; eauto. intros [(T2 & D & E) | [(D & E & F) | (S3 & T2 & D & E & F)]]. -+ exists S2, T2. intuition auto using star_refl, plus_one. ++ exists S2, T2. intuition auto using star_refl. + subst t. exists S2, T1. intuition auto using star_refl. + assert (wt_state S3) by (eapply subject_reduction_star; eauto using wt_prog). exists S3, T2. intuition auto using plus_one. -- cgit From 19aed83caebcae1103e0c4f6e200744492f17545 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 24 Apr 2020 15:17:37 +0200 Subject: Use Hashtbl.find_opt. Replace the pattern `try Some (Hashtbl.find ...) with Not_found -> None` by a call to the function Hashtbl.find_opt. --- aarch64/Machregsaux.ml | 2 +- arm/Machregsaux.ml | 2 +- cparser/Bitfields.ml | 3 +-- lib/Readconfig.mll | 2 +- powerpc/Machregsaux.ml | 2 +- riscV/Machregsaux.ml | 2 +- tools/modorder.ml | 2 +- x86/Machregsaux.ml | 2 +- 8 files changed, 8 insertions(+), 9 deletions(-) diff --git a/aarch64/Machregsaux.ml b/aarch64/Machregsaux.ml index d7f10b9b..39008965 100644 --- a/aarch64/Machregsaux.ml +++ b/aarch64/Machregsaux.ml @@ -27,7 +27,7 @@ let is_scratch_register s = let name_of_register r = - try Some (Hashtbl.find register_names r) with Not_found -> None + Hashtbl.find_opt register_names r let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/arm/Machregsaux.ml b/arm/Machregsaux.ml index ce5c67f6..21425851 100644 --- a/arm/Machregsaux.ml +++ b/arm/Machregsaux.ml @@ -25,7 +25,7 @@ let _ = let is_scratch_register s = s = "R14" || s = "r14" let name_of_register r = - try Some (Hashtbl.find register_names r) with Not_found -> None + Hashtbl.find_opt register_names r let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/cparser/Bitfields.ml b/cparser/Bitfields.ml index 9ca40e70..7a00f719 100644 --- a/cparser/Bitfields.ml +++ b/cparser/Bitfields.ml @@ -50,8 +50,7 @@ let bitfield_table = (Hashtbl.create 57: (ident * string, bitfield_info) Hashtbl.t) let is_bitfield structid fieldname = - try Some (Hashtbl.find bitfield_table (structid, fieldname)) - with Not_found -> None + Hashtbl.find_opt bitfield_table (structid, fieldname) (* Mapping struct/union identifier -> list of members after transformation, including the carrier fields, but without the bit fields. diff --git a/lib/Readconfig.mll b/lib/Readconfig.mll index 7b98255e..8abcc407 100644 --- a/lib/Readconfig.mll +++ b/lib/Readconfig.mll @@ -20,7 +20,7 @@ let key_val_tbl : (string, string list) Hashtbl.t = Hashtbl.create 17 let key_val key = - try Some(Hashtbl.find key_val_tbl key) with Not_found -> None + Hashtbl.find_opt key_val_tbl key (* Auxiliaries for parsing *) diff --git a/powerpc/Machregsaux.ml b/powerpc/Machregsaux.ml index 664f71a0..711eb623 100644 --- a/powerpc/Machregsaux.ml +++ b/powerpc/Machregsaux.ml @@ -25,7 +25,7 @@ let _ = let is_scratch_register s = s = "R0" || s = "r0" let name_of_register r = - try Some (Hashtbl.find register_names r) with Not_found -> None + Hashtbl.find_opt register_names r let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/riscV/Machregsaux.ml b/riscV/Machregsaux.ml index 473e0602..82d3803e 100644 --- a/riscV/Machregsaux.ml +++ b/riscV/Machregsaux.ml @@ -25,7 +25,7 @@ let _ = let is_scratch_register r = false let name_of_register r = - try Some (Hashtbl.find register_names r) with Not_found -> None + Hashtbl.find_opt register_names r let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/tools/modorder.ml b/tools/modorder.ml index d1203568..7ca6a9e9 100644 --- a/tools/modorder.ml +++ b/tools/modorder.ml @@ -84,7 +84,7 @@ let filename_suffix s = let emit_dependencies deps targets = let rec dsort target suff = - match (try Some(Hashtbl.find deps target) with Not_found -> None) with + match Hashtbl.find_opt deps target with | None -> () | Some node -> match node.status with diff --git a/x86/Machregsaux.ml b/x86/Machregsaux.ml index 473e0602..82d3803e 100644 --- a/x86/Machregsaux.ml +++ b/x86/Machregsaux.ml @@ -25,7 +25,7 @@ let _ = let is_scratch_register r = false let name_of_register r = - try Some (Hashtbl.find register_names r) with Not_found -> None + Hashtbl.find_opt register_names r let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) -- cgit From 127b00c573ca5fef4245e77bac89e1093a7ec0d2 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 24 Apr 2020 15:21:44 +0200 Subject: Use library function. The function String.uppercase was deprecated and the replacement function String.upercase_ascii was only available from OCaml 4.03.0. Since the minimal OCaml version is now 4.05.0 we can use the function String.upercase_ascii. --- cparser/Elab.ml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 9e17cb7e..4f2ddce7 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -329,10 +329,7 @@ let integer_representable v ik = v >= 0L && v < Int64.shift_left 1L (bitsize - 1) let elab_int_constant loc s0 = - let s = String.map (fun d -> match d with - | '0'..'9' | 'A'..'F' | 'L' | 'U' | 'X' -> d - | 'a'..'f' | 'l' | 'u' | 'x' -> Char.chr (Char.code d - 32) - | _ -> error loc "bad digit '%c' in integer literal '%s'" d s0; d) s0 in + let s = String.uppercase_ascii s0 in (* Determine possible types and chop type suffix *) let (s, dec_kinds, hex_kinds) = if has_suffix s "ULL" || has_suffix s "LLU" then -- cgit From faa1d7fbfd7c9d5aa333d9b353a6118e105c4428 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Sat, 25 Apr 2020 16:52:33 +0200 Subject: Remove the `can_reserve_register` function. The function is in fact just a call to the function`is_callee_save_register` from `Conventions1.v`. --- aarch64/Machregsaux.ml | 2 -- arm/Machregsaux.ml | 4 ---- arm/Machregsaux.mli | 1 - cfrontend/CPragmas.ml | 2 +- powerpc/Machregsaux.ml | 4 ---- powerpc/Machregsaux.mli | 1 - riscV/Machregsaux.ml | 2 -- riscV/Machregsaux.mli | 1 - x86/Machregsaux.ml | 2 -- x86/Machregsaux.mli | 1 - 10 files changed, 1 insertion(+), 19 deletions(-) diff --git a/aarch64/Machregsaux.ml b/aarch64/Machregsaux.ml index 39008965..7d233041 100644 --- a/aarch64/Machregsaux.ml +++ b/aarch64/Machregsaux.ml @@ -31,5 +31,3 @@ let name_of_register r = let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) - -let can_reserve_register r = Conventions1.is_callee_save r diff --git a/arm/Machregsaux.ml b/arm/Machregsaux.ml index 21425851..7d278613 100644 --- a/arm/Machregsaux.ml +++ b/arm/Machregsaux.ml @@ -29,7 +29,3 @@ let name_of_register r = let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) - -let can_reserve_register r = - List.mem r Conventions1.int_callee_save_regs - || List.mem r Conventions1.float_callee_save_regs diff --git a/arm/Machregsaux.mli b/arm/Machregsaux.mli index 9404568d..884100bb 100644 --- a/arm/Machregsaux.mli +++ b/arm/Machregsaux.mli @@ -15,4 +15,3 @@ val name_of_register: Machregs.mreg -> string option val register_by_name: string -> Machregs.mreg option val is_scratch_register: string -> bool -val can_reserve_register: Machregs.mreg -> bool diff --git a/cfrontend/CPragmas.ml b/cfrontend/CPragmas.ml index ce2cfcf0..92cf4cec 100644 --- a/cfrontend/CPragmas.ml +++ b/cfrontend/CPragmas.ml @@ -56,7 +56,7 @@ let process_reserve_register_pragma name = | None -> C2C.error "unknown register in `reserve_register' pragma" | Some r -> - if Machregsaux.can_reserve_register r then + if Conventions1.is_callee_save r then reserved_registers := r :: !reserved_registers else C2C.error "cannot reserve this register (not a callee-save)" diff --git a/powerpc/Machregsaux.ml b/powerpc/Machregsaux.ml index 711eb623..40c993fd 100644 --- a/powerpc/Machregsaux.ml +++ b/powerpc/Machregsaux.ml @@ -29,7 +29,3 @@ let name_of_register r = let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) - -let can_reserve_register r = - List.mem r Conventions1.int_callee_save_regs - || List.mem r Conventions1.float_callee_save_regs diff --git a/powerpc/Machregsaux.mli b/powerpc/Machregsaux.mli index 9404568d..884100bb 100644 --- a/powerpc/Machregsaux.mli +++ b/powerpc/Machregsaux.mli @@ -15,4 +15,3 @@ val name_of_register: Machregs.mreg -> string option val register_by_name: string -> Machregs.mreg option val is_scratch_register: string -> bool -val can_reserve_register: Machregs.mreg -> bool diff --git a/riscV/Machregsaux.ml b/riscV/Machregsaux.ml index 82d3803e..a273bb51 100644 --- a/riscV/Machregsaux.ml +++ b/riscV/Machregsaux.ml @@ -29,5 +29,3 @@ let name_of_register r = let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) - -let can_reserve_register r = Conventions1.is_callee_save r diff --git a/riscV/Machregsaux.mli b/riscV/Machregsaux.mli index 9404568d..884100bb 100644 --- a/riscV/Machregsaux.mli +++ b/riscV/Machregsaux.mli @@ -15,4 +15,3 @@ val name_of_register: Machregs.mreg -> string option val register_by_name: string -> Machregs.mreg option val is_scratch_register: string -> bool -val can_reserve_register: Machregs.mreg -> bool diff --git a/x86/Machregsaux.ml b/x86/Machregsaux.ml index 82d3803e..a273bb51 100644 --- a/x86/Machregsaux.ml +++ b/x86/Machregsaux.ml @@ -29,5 +29,3 @@ let name_of_register r = let register_by_name s = Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) - -let can_reserve_register r = Conventions1.is_callee_save r diff --git a/x86/Machregsaux.mli b/x86/Machregsaux.mli index 9404568d..884100bb 100644 --- a/x86/Machregsaux.mli +++ b/x86/Machregsaux.mli @@ -15,4 +15,3 @@ val name_of_register: Machregs.mreg -> string option val register_by_name: string -> Machregs.mreg option val is_scratch_register: string -> bool -val can_reserve_register: Machregs.mreg -> bool -- cgit From ad2ea9c2e701dd82c26e6cd3e8a777be9bdef2a2 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 29 Apr 2020 15:12:54 +0200 Subject: Move shared code in new file. The name_of_register and register_of_name function are shared between all architectures and can be moved in a common file. --- aarch64/Machregsaux.ml | 17 ----------------- arm/Machregsaux.ml | 16 ---------------- arm/Machregsaux.mli | 2 -- backend/IRC.ml | 2 +- backend/Machregsnames.ml | 24 ++++++++++++++++++++++++ backend/Machregsnames.mli | 16 ++++++++++++++++ backend/PrintLTL.ml | 2 +- backend/PrintMach.ml | 3 +-- backend/PrintXTL.ml | 2 +- cfrontend/CPragmas.ml | 2 +- cparser/ExtendedAsm.ml | 2 +- powerpc/Machregsaux.ml | 16 ---------------- powerpc/Machregsaux.mli | 2 -- riscV/Machregsaux.ml | 16 ---------------- riscV/Machregsaux.mli | 2 -- x86/Machregsaux.ml | 16 ---------------- x86/Machregsaux.mli | 2 -- 17 files changed, 46 insertions(+), 96 deletions(-) create mode 100644 backend/Machregsnames.ml create mode 100644 backend/Machregsnames.mli diff --git a/aarch64/Machregsaux.ml b/aarch64/Machregsaux.ml index 7d233041..5f3c1a8d 100644 --- a/aarch64/Machregsaux.ml +++ b/aarch64/Machregsaux.ml @@ -12,22 +12,5 @@ (** Auxiliary functions on machine registers *) -open Camlcoq -open Machregs - -let register_names : (mreg, string) Hashtbl.t = Hashtbl.create 31 - -let _ = - List.iter - (fun (s, r) -> Hashtbl.add register_names r (camlstring_of_coqstring s)) - Machregs.register_names - let is_scratch_register s = s = "X16" || s = "x16" || s = "X30" || s = "x30" - - -let name_of_register r = - Hashtbl.find_opt register_names r - -let register_by_name s = - Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/arm/Machregsaux.ml b/arm/Machregsaux.ml index 7d278613..a4624a9d 100644 --- a/arm/Machregsaux.ml +++ b/arm/Machregsaux.ml @@ -12,20 +12,4 @@ (** Auxiliary functions on machine registers *) -open Camlcoq -open Machregs - -let register_names : (mreg, string) Hashtbl.t = Hashtbl.create 31 - -let _ = - List.iter - (fun (s, r) -> Hashtbl.add register_names r (camlstring_of_coqstring s)) - Machregs.register_names - let is_scratch_register s = s = "R14" || s = "r14" - -let name_of_register r = - Hashtbl.find_opt register_names r - -let register_by_name s = - Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/arm/Machregsaux.mli b/arm/Machregsaux.mli index 884100bb..f3d52849 100644 --- a/arm/Machregsaux.mli +++ b/arm/Machregsaux.mli @@ -12,6 +12,4 @@ (** Auxiliary functions on machine registers *) -val name_of_register: Machregs.mreg -> string option -val register_by_name: string -> Machregs.mreg option val is_scratch_register: string -> bool diff --git a/backend/IRC.ml b/backend/IRC.ml index e94d6fbb..ed5ae186 100644 --- a/backend/IRC.ml +++ b/backend/IRC.ml @@ -101,7 +101,7 @@ after IRC elimination, when assigning a stack slot to a spilled variable. *) let name_of_loc = function | R r -> - begin match Machregsaux.name_of_register r with + begin match Machregsnames.name_of_register r with | None -> "fixed-reg" | Some s -> s end diff --git a/backend/Machregsnames.ml b/backend/Machregsnames.ml new file mode 100644 index 00000000..fdcbd0e5 --- /dev/null +++ b/backend/Machregsnames.ml @@ -0,0 +1,24 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +let register_names : (Machregs.mreg, string) Hashtbl.t = Hashtbl.create 31 + +let _ = + List.iter + (fun (s, r) -> Hashtbl.add register_names r (Camlcoq.camlstring_of_coqstring s)) + Machregs.register_names + +let name_of_register r = + Hashtbl.find_opt register_names r + +let register_by_name s = + Machregs.register_by_name (Camlcoq.coqstring_uppercase_ascii_of_camlstring s) diff --git a/backend/Machregsnames.mli b/backend/Machregsnames.mli new file mode 100644 index 00000000..1b600d35 --- /dev/null +++ b/backend/Machregsnames.mli @@ -0,0 +1,16 @@ +(* *********************************************************************) +(* *) +(* The Compcert verified compiler *) +(* *) +(* Xavier Leroy, INRIA Paris-Rocquencourt *) +(* *) +(* Copyright Institut National de Recherche en Informatique et en *) +(* Automatique. All rights reserved. This file is distributed *) +(* under the terms of the INRIA Non-Commercial License Agreement. *) +(* *) +(* *********************************************************************) + +(** Auxiliary functions on machine registers *) + +val name_of_register: Machregs.mreg -> string option +val register_by_name: string -> Machregs.mreg option diff --git a/backend/PrintLTL.ml b/backend/PrintLTL.ml index 1c449e74..d75ba19c 100644 --- a/backend/PrintLTL.ml +++ b/backend/PrintLTL.ml @@ -22,7 +22,7 @@ open PrintAST open PrintOp let mreg pp r = - match Machregsaux.name_of_register r with + match Machregsnames.name_of_register r with | Some s -> fprintf pp "%s" s | None -> fprintf pp "" diff --git a/backend/PrintMach.ml b/backend/PrintMach.ml index 517f3037..8a5f9a7c 100644 --- a/backend/PrintMach.ml +++ b/backend/PrintMach.ml @@ -16,12 +16,11 @@ open Printf open Camlcoq open Datatypes open AST -open Machregsaux open Mach open PrintAST let reg pp r = - match name_of_register r with + match Machregsnames.name_of_register r with | Some s -> fprintf pp "%s" s | None -> fprintf pp "" diff --git a/backend/PrintXTL.ml b/backend/PrintXTL.ml index 6432682a..aeaef25e 100644 --- a/backend/PrintXTL.ml +++ b/backend/PrintXTL.ml @@ -22,7 +22,7 @@ open PrintOp open XTL let mreg pp r = - match Machregsaux.name_of_register r with + match Machregsnames.name_of_register r with | Some s -> fprintf pp "%s" s | None -> fprintf pp "" diff --git a/cfrontend/CPragmas.ml b/cfrontend/CPragmas.ml index 92cf4cec..22ab2b5a 100644 --- a/cfrontend/CPragmas.ml +++ b/cfrontend/CPragmas.ml @@ -52,7 +52,7 @@ let process_use_section_pragma classname id = let reserved_registers = ref ([]: Machregs.mreg list) let process_reserve_register_pragma name = - match Machregsaux.register_by_name name with + match Machregsnames.register_by_name name with | None -> C2C.error "unknown register in `reserve_register' pragma" | Some r -> diff --git a/cparser/ExtendedAsm.ml b/cparser/ExtendedAsm.ml index 257e9cf7..df2da2a2 100644 --- a/cparser/ExtendedAsm.ml +++ b/cparser/ExtendedAsm.ml @@ -156,7 +156,7 @@ let transf_outputs loc env = function let check_clobbers loc clob = List.iter (fun c -> - if Machregsaux.register_by_name c <> None + if Machregsnames.register_by_name c <> None || Machregsaux.is_scratch_register c || c = "memory" || c = "cc" (* GCC does not accept MEMORY or CC *) then () diff --git a/powerpc/Machregsaux.ml b/powerpc/Machregsaux.ml index 40c993fd..9d3a2243 100644 --- a/powerpc/Machregsaux.ml +++ b/powerpc/Machregsaux.ml @@ -12,20 +12,4 @@ (** Auxiliary functions on machine registers *) -open Camlcoq -open Machregs - -let register_names : (mreg, string) Hashtbl.t = Hashtbl.create 31 - -let _ = - List.iter - (fun (s, r) -> Hashtbl.add register_names r (camlstring_of_coqstring s)) - Machregs.register_names - let is_scratch_register s = s = "R0" || s = "r0" - -let name_of_register r = - Hashtbl.find_opt register_names r - -let register_by_name s = - Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/powerpc/Machregsaux.mli b/powerpc/Machregsaux.mli index 884100bb..f3d52849 100644 --- a/powerpc/Machregsaux.mli +++ b/powerpc/Machregsaux.mli @@ -12,6 +12,4 @@ (** Auxiliary functions on machine registers *) -val name_of_register: Machregs.mreg -> string option -val register_by_name: string -> Machregs.mreg option val is_scratch_register: string -> bool diff --git a/riscV/Machregsaux.ml b/riscV/Machregsaux.ml index a273bb51..a48749a5 100644 --- a/riscV/Machregsaux.ml +++ b/riscV/Machregsaux.ml @@ -12,20 +12,4 @@ (** Auxiliary functions on machine registers *) -open Camlcoq -open Machregs - -let register_names : (mreg, string) Hashtbl.t = Hashtbl.create 31 - -let _ = - List.iter - (fun (s, r) -> Hashtbl.add register_names r (camlstring_of_coqstring s)) - Machregs.register_names - let is_scratch_register r = false - -let name_of_register r = - Hashtbl.find_opt register_names r - -let register_by_name s = - Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/riscV/Machregsaux.mli b/riscV/Machregsaux.mli index 884100bb..f3d52849 100644 --- a/riscV/Machregsaux.mli +++ b/riscV/Machregsaux.mli @@ -12,6 +12,4 @@ (** Auxiliary functions on machine registers *) -val name_of_register: Machregs.mreg -> string option -val register_by_name: string -> Machregs.mreg option val is_scratch_register: string -> bool diff --git a/x86/Machregsaux.ml b/x86/Machregsaux.ml index a273bb51..a48749a5 100644 --- a/x86/Machregsaux.ml +++ b/x86/Machregsaux.ml @@ -12,20 +12,4 @@ (** Auxiliary functions on machine registers *) -open Camlcoq -open Machregs - -let register_names : (mreg, string) Hashtbl.t = Hashtbl.create 31 - -let _ = - List.iter - (fun (s, r) -> Hashtbl.add register_names r (camlstring_of_coqstring s)) - Machregs.register_names - let is_scratch_register r = false - -let name_of_register r = - Hashtbl.find_opt register_names r - -let register_by_name s = - Machregs.register_by_name (coqstring_uppercase_ascii_of_camlstring s) diff --git a/x86/Machregsaux.mli b/x86/Machregsaux.mli index 884100bb..f3d52849 100644 --- a/x86/Machregsaux.mli +++ b/x86/Machregsaux.mli @@ -12,6 +12,4 @@ (** Auxiliary functions on machine registers *) -val name_of_register: Machregs.mreg -> string option -val register_by_name: string -> Machregs.mreg option val is_scratch_register: string -> bool -- cgit From fde847543e8169082db0138a9713a8c0ab0cc167 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 30 Jun 2020 12:44:23 +0200 Subject: Added missing hint database name. --- arm/Asmgenproof.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/Asmgenproof.v b/arm/Asmgenproof.v index 25f91d23..a592e12a 100644 --- a/arm/Asmgenproof.v +++ b/arm/Asmgenproof.v @@ -225,7 +225,7 @@ Proof. TailNoLabel. eapply tail_nolabel_trans; TailNoLabel. Qed. -Hint Resolve indexed_memory_access_label. +Hint Resolve indexed_memory_access_label: labels. Remark loadind_label: forall base ofs ty dst k c, loadind base ofs ty dst k = OK c -> tail_nolabel k c. -- cgit From c94405f67ca18be997974f88ff91c072d8a5c0cb Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 1 Jul 2020 14:13:25 +0200 Subject: Fix typo in name of builtin function. --- powerpc/Machregs.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerpc/Machregs.v b/powerpc/Machregs.v index e7c8758b..07622a0e 100644 --- a/powerpc/Machregs.v +++ b/powerpc/Machregs.v @@ -232,7 +232,7 @@ Definition mregs_for_builtin (ef: external_function): list (option mreg) * list | EF_builtin id sg => if string_dec id "__builtin_atomic_exchange" then ((Some R3)::(Some R4)::(Some R5)::nil,nil) else if string_dec id "__builtin_sync_fetch_and_add" then ((Some R4)::(Some R5)::nil,(Some R3)::nil) - else if string_dec id "___builtin_atomic_compare_exchange" then ((Some R4)::(Some R5)::(Some R6)::nil, (Some R3):: nil) + else if string_dec id "__builtin_atomic_compare_exchange" then ((Some R4)::(Some R5)::(Some R6)::nil, (Some R3):: nil) else (nil, nil) | _ => (nil, nil) end. -- cgit From bb9fa5550d6145344c4ed296ed980cb419e4cb27 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 1 Jul 2020 15:16:55 +0200 Subject: Added asserts for constraints of PowerPC builtins --- powerpc/Asmexpand.ml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index ce88778c..1854ec16 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -767,6 +767,8 @@ let expand_builtin_inline name args res = emit (Pori (GPR0, GPR0, Cint _0)) (* atomic operations *) | "__builtin_atomic_exchange", [BA (IR a1); BA (IR a2); BA (IR a3)],_ -> + (* Register constraints imposed by Machregs.v *) + assert(a1 = GPR3 && a2 = GPR4 && a3 = GPR5); emit (Plwz (GPR10,Cint _0,a2)); emit (Psync); let lbl = new_label() in @@ -786,6 +788,8 @@ let expand_builtin_inline name args res = emit (Pisync); emit (Pstw (GPR0,Cint _0, a2)) | "__builtin_sync_fetch_and_add", [BA (IR a1); BA(IR a2)], BR (IR res) -> + (* Register constraints imposed by Machregs.v *) + assert (a1 = GPR4 && a2 = GPR5 && res = GPR3); let lbl = new_label() in emit (Psync); emit (Plabel lbl); @@ -795,6 +799,8 @@ let expand_builtin_inline name args res = emit (Pbf (CRbit_2, lbl)); emit (Pisync); | "__builtin_atomic_compare_exchange", [BA (IR dst); BA(IR exp); BA (IR des)], BR (IR res) -> + (* Register constraints imposed by Machregs.v *) + assert (dst = GPR4 && exp = GPR5 && des = GPR6 && res = GPR3); let lbls = new_label () and lblneq = new_label () and lblsucc = new_label () in -- cgit From 3b1f3dd57d8c10c1c29f67f0f745e3263d9d3daf Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 7 Jul 2020 14:07:37 +0200 Subject: Revised detection of menhirLib directory (#248) Use `ocamlfind query menhirLib` in preference to `menhir --suggest-menhirLib`. Fixes: #363 --- configure | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure b/configure index b358f3cb..432bacff 100755 --- a/configure +++ b/configure @@ -582,8 +582,12 @@ case "$menhir_ver" in 20[0-9][0-9][0-9][0-9][0-9][0-9]) if test "$menhir_ver" -ge $MENHIR_REQUIRED; then echo "version $menhir_ver -- good!" - menhir_dir=$(menhir --suggest-menhirLib | tr -d '\r' | tr '\\' '/') - if test -z "$menhir_dir"; then + menhir_dir=$(ocamlfind query menhirLib 2>/dev/null \ + | tr -d '\r' | tr '\\' '/') || \ + menhir_dir=$(menhir --suggest-menhirLib \ + | tr -d '\r' | tr '\\' '/') || \ + menhir_dir="" + if test ! -d "$menhir_dir"; then echo "Error: cannot determine the location of the Menhir API library." echo "This can be due to an incorrect Menhir package." echo "Consider using the OPAM package for Menhir." -- cgit From 9af28924713d14d833dcaf95cd3338ef68fbfc97 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 7 Jul 2020 14:08:24 +0200 Subject: Bytecode-only build (#243) If ocamlopt (the native-code OCaml compiler) is not available, fall back to building with ocamlc (the bytecode OCaml compiler). Fixes: #359 --- Makefile.extr | 16 +++++++++++++++- configure | 17 ++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Makefile.extr b/Makefile.extr index 5948bfc6..b417945b 100644 --- a/Makefile.extr +++ b/Makefile.extr @@ -19,7 +19,8 @@ include Makefile.config # # Variables from Makefile.config: -# -OCAML_OPT_COMP: can we use the native version +# -OCAML_NATIVE_COMP: native-code compilation is supported +# -OCAML_OPT_COMP: can we use the natively-compiled compilers # -COMPFLAGS: compile options # -LINK_OPT: additional linker flags for the native binary # @@ -71,6 +72,7 @@ OCAMLDEP=ocamldep$(DOTOPT) -slash $(INCLUDES) OCAMLLEX=ocamllex -q MODORDER=tools/modorder .depend.extr +COPY=cp PARSERS=cparser/pre_parser.mly LEXERS=cparser/Lexer.mll lib/Tokenize.mll \ @@ -88,9 +90,15 @@ ifeq ($(wildcard .depend.extr),.depend.extr) CCOMP_OBJS:=$(shell $(MODORDER) driver/Driver.cmx) +ifeq ($(OCAML_NATIVE_COMP),true) ccomp: $(CCOMP_OBJS) @echo "Linking $@" @$(OCAMLOPT) -o $@ $(LIBS) $(LINK_OPT) $+ +else +ccomp: ccomp.byte + @echo "Copying to $@" + @$(COPY) $+ $@ +endif ccomp.byte: $(CCOMP_OBJS:.cmx=.cmo) @echo "Linking $@" @@ -98,9 +106,15 @@ ccomp.byte: $(CCOMP_OBJS:.cmx=.cmo) CLIGHTGEN_OBJS:=$(shell $(MODORDER) exportclight/Clightgen.cmx) +ifeq ($(OCAML_NATIVE_COMP),true) clightgen: $(CLIGHTGEN_OBJS) @echo "Linking $@" @$(OCAMLOPT) -o $@ $(LIBS) $(LINK_OPT) $+ +else +clightgen: clightgen.byte + @echo "Copying to $@" + @$(COPY) $+ $@ +endif clightgen.byte: $(CLIGHTGEN_OBJS:.cmx=.cmo) @echo "Linking $@" diff --git a/configure b/configure index 432bacff..d38deeec 100755 --- a/configure +++ b/configure @@ -547,7 +547,7 @@ case "$coq_ver" in esac echo "Testing OCaml... " | tr -d '\n' -ocaml_ver=`ocamlopt -version 2>/dev/null` +ocaml_ver=`ocamlc -version 2>/dev/null` case "$ocaml_ver" in 4.00.*|4.01.*| 4.02.*|4.03.*|4.04.*) echo "version $ocaml_ver -- UNSUPPORTED" @@ -565,9 +565,19 @@ case "$ocaml_ver" in missingtools=true;; esac +echo "Testing OCaml native-code compiler..." | tr -d '\n' +ocamlopt_ver=`ocamlopt -version 2>/dev/null` +if test "$ocamlopt_ver" = "$ocaml_ver"; then + echo "yes" + ocaml_native_comp=true +else + echo "no, will build to bytecode only" + ocaml_native_comp=false +fi + echo "Testing OCaml .opt compilers... " | tr -d '\n' -ocaml_opt_ver=`ocamlopt.opt -version 2>/dev/null` -if test "$ocaml_opt_ver" = "$ocaml_ver"; then +ocamlopt_opt_ver=`ocamlopt.opt -version 2>/dev/null` +if test "$ocamlopt_opt_ver" = "$ocaml_ver"; then echo "yes" ocaml_opt_comp=true else @@ -680,6 +690,7 @@ LIBDIR=$libdir MANDIR=$sharedir/man SHAREDIR=$sharedir COQDEVDIR=$coqdevdir +OCAML_NATIVE_COMP=$ocaml_native_comp OCAML_OPT_COMP=$ocaml_opt_comp MENHIR_DIR=$menhir_dir COMPFLAGS=-bin-annot -- cgit From fdaa2a3e7269ab5fc6fade4ac56699ad21de1bda Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 1 Jul 2020 19:33:12 +0200 Subject: Add option to print version information in file --- driver/CommonOptions.ml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index c151ecf2..fc7bbb77 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -24,9 +24,24 @@ let version_string tool_name = let print_version_and_exit tool_name () = Printf.printf "%s" (version_string tool_name); exit 0 +let version_file_string tool_name = + if Version.buildnr <> "" && Version.tag <> "" then + Printf.sprintf "This is CompCert %s,\nVersion: %s,\nBuild: %s,\nTag: %s\n" tool_name Version.version Version.buildnr Version.tag + else + Printf.sprintf "The CompCert %s,\nversion %s\n" tool_name Version.version + +let print_version_file_and_exit tool_name file = + let oc = open_out_bin file in + output_string oc (version_file_string tool_name); + close_out_noerr oc; + exit 0 + let version_options tool_name = [ Exact "-version", Unit (print_version_and_exit tool_name); - Exact "--version", Unit (print_version_and_exit tool_name);] + Exact "--version", Unit (print_version_and_exit tool_name); + Exact "-version-file", String (print_version_file_and_exit tool_name); + Exact "--version-file", String (print_version_file_and_exit tool_name); + ] (* Language support options *) @@ -76,6 +91,7 @@ let general_help = -v Print external commands before invoking them -timings Show the time spent in various compiler passes -version Print the version string and exit + -version-file Print version inforation to and exit -target Generate code for the given target -conf Read configuration from file @ Read command line options from -- cgit From f8cfbc1bc22c06835e9ea7b0cab41a8f25b523ba Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 2 Jul 2020 14:52:34 +0200 Subject: Introduce additional "branch" build information. --- Makefile | 5 ++++- VERSION | 1 + backend/PrintAsmaux.ml | 4 ++-- cparser/Diagnostics.ml | 10 +++++----- debug/Dwarfgen.ml | 4 ++-- driver/CommonOptions.ml | 8 +++++--- exportclight/ExportClight.ml | 1 + 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index d91c5f37..5e97ebbf 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ include VERSION BUILDVERSION ?= $(version) BUILDNR ?= $(buildnr) TAG ?= $(tag) +BRANCH ?= $(branch) ifeq ($(wildcard $(ARCH)_$(BITSIZE)),) ARCHDIRS=$(ARCH) @@ -238,12 +239,14 @@ compcert.config: Makefile.config echo "COMPCERT_VERSION=$(BUILDVERSION)"; \ echo "COMPCERT_BUILDNR=$(BUILDNR)"; \ echo "COMPCERT_TAG=$(TAG)" \ + echo "COMPCERT_BRANCH=$(BRANCH)" \ ) > compcert.config driver/Version.ml: VERSION (echo 'let version = "$(BUILDVERSION)"'; \ echo 'let buildnr = "$(BUILDNR)"'; \ - echo 'let tag = "$(TAG)"';) > driver/Version.ml + echo 'let tag = "$(TAG)"'; \ + echo 'let branch = "$(BRANCH)"') > driver/Version.ml cparser/Parser.v: cparser/Parser.vy @rm -f $@ diff --git a/VERSION b/VERSION index b60e8d9b..f544e624 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,4 @@ version=3.7 buildnr= tag= +branch= diff --git a/backend/PrintAsmaux.ml b/backend/PrintAsmaux.ml index d82e6f84..d31507ff 100644 --- a/backend/PrintAsmaux.ml +++ b/backend/PrintAsmaux.ml @@ -293,8 +293,8 @@ let print_inline_asm print_preg oc txt sg args res = let print_version_and_options oc comment = let version_string = - if Version.buildnr <> "" && Version.tag <> "" then - sprintf "Release: %s, Build: %s, Tag: %s" Version.version Version.buildnr Version.tag + if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then + sprintf "Release: %s, Build: %s, Tag: %s, Branch: %s" Version.version Version.buildnr Version.tag Version.branch else Version.version in fprintf oc "%s File generated by CompCert %s\n" comment version_string; diff --git a/cparser/Diagnostics.ml b/cparser/Diagnostics.ml index 7957375c..86a5e522 100644 --- a/cparser/Diagnostics.ml +++ b/cparser/Diagnostics.ml @@ -400,16 +400,16 @@ let raise_on_errors () = raise Abort let crash exn = - if Version.buildnr <> "" && Version.tag <> "" then begin + if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then begin let backtrace = Printexc.get_backtrace () in - eprintf "%tThis is CompCert, Release %s, Build:%s, Tag:%s%t\n" - bc Version.version Version.buildnr Version.tag rsc; + eprintf "%tThis is CompCert, Release %s, Build:%s, Tag:%s, Branch:%s%t\n" + bc Version.version Version.buildnr Version.tag Version.branch rsc; eprintf "Backtrace (please include this in your support request):\n%s" backtrace; eprintf "%tUncaught exception: %s.\n\ \ Please report this problem to our support.\n\ -\ Error occurred in Build: %s, Tag: %s.\n%t" - rc (Printexc.to_string exn) Version.buildnr Version.tag rsc; +\ Error occurred in Build: %s, Tag: %s, Branch %s.\n%t" + rc (Printexc.to_string exn) Version.buildnr Version.tag Version.branch rsc; exit 2 end else begin let backtrace = Printexc.get_backtrace () diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml index 6c1d0846..020ac60e 100644 --- a/debug/Dwarfgen.ml +++ b/debug/Dwarfgen.ml @@ -543,8 +543,8 @@ let diab_file_loc sec (f,l) = let prod_name = let version_string = - if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "Release: %s, Build: %s, Tag: %s" Version.version Version.buildnr Version.tag + if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then + Printf.sprintf "Release: %s, Build: %s, Tag: %s, Branch:%s" Version.version Version.buildnr Version.tag Version.branch else Version.version in Printf.sprintf "AbsInt Angewandte Informatik GmbH:CompCert Version %s:(%s,%s,%s,%s)" diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index fc7bbb77..a2f249c1 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -15,8 +15,9 @@ open Commandline (* The version string for [tool_name] *) let version_string tool_name = - if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "The CompCert %s, Release: %s, Build: %s, Tag: %s\n" tool_name Version.version Version.buildnr Version.tag + if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then + Printf.sprintf "The CompCert %s, Release: %s, Build: %s, Tag: %s, Branch %s\n" + tool_name Version.version Version.buildnr Version.tag Version.branch else Printf.sprintf "The CompCert %s, version %s\n" tool_name Version.version @@ -26,7 +27,8 @@ let print_version_and_exit tool_name () = let version_file_string tool_name = if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "This is CompCert %s,\nVersion: %s,\nBuild: %s,\nTag: %s\n" tool_name Version.version Version.buildnr Version.tag + Printf.sprintf "This is CompCert %s,\nVersion: %s,\nBuild: %s,\nTag: %s,\nBranch: %s\n" + tool_name Version.version Version.buildnr Version.tag Version.branch else Printf.sprintf "The CompCert %s,\nversion %s\n" tool_name Version.version diff --git a/exportclight/ExportClight.ml b/exportclight/ExportClight.ml index 321ed8c9..4a85b591 100644 --- a/exportclight/ExportClight.ml +++ b/exportclight/ExportClight.ml @@ -514,6 +514,7 @@ let print_clightgen_info p sourcefile normalized = fprintf p "@ Definition version := %S." Version.version; fprintf p "@ Definition build_number := %S." Version.buildnr; fprintf p "@ Definition build_tag := %S." Version.tag; + fprintf p "@ Definition build_branch := %S." Version.branch; fprintf p "@ Definition arch := %S." Configuration.arch; fprintf p "@ Definition model := %S." Configuration.model; fprintf p "@ Definition abi := %S." Configuration.abi; -- cgit From ae7eeb880d35fb12b4620e5320a8f9677a72d159 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 2 Jul 2020 15:30:58 +0200 Subject: Remove no longer needed option enforce-buildnr --- driver/Driver.ml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/driver/Driver.ml b/driver/Driver.ml index be1252f9..66cfeaa7 100644 --- a/driver/Driver.ml +++ b/driver/Driver.ml @@ -238,12 +238,6 @@ Code generation options: (use -fno- to turn off -f) let print_usage_and_exit () = printf "%s" usage_string; exit 0 -let enforce_buildnr nr = - let build = int_of_string Version.buildnr in - if nr != build then - fatal_error no_loc "Mismatching builds: This is CompCert build %d, but QSK requires build %d.\n\ -Please use matching builds of QSK and CompCert." build nr - let dump_mnemonics destfile = let oc = open_out_bin destfile in let pp = Format.formatter_of_out_channel oc in @@ -279,10 +273,7 @@ let cmdline_actions = @ version_options tool_name @ (* Enforcing CompCert build numbers for QSKs and mnemonics dump *) (if Version.buildnr <> "" then - [ Exact "-qsk-enforce-build", Integer enforce_buildnr; - Exact "--qsk-enforce-build", Integer enforce_buildnr; - Exact "-dump-mnemonics", String dump_mnemonics; - ] + [Exact "-dump-mnemonics", String dump_mnemonics;] else []) @ (* Processing options *) [ Exact "-c", Set option_c; -- cgit From 1a01ad629109cdb60fddae3787e3a589d20e9790 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 7 Jul 2020 18:36:31 +0200 Subject: Use the same version string. The version string dumped in the file should be the same as the version string printed by `-version`. The option is also not printed by `-help` since it is for internal use only. --- driver/CommonOptions.ml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index a2f249c1..e0e75e58 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -16,7 +16,7 @@ open Commandline (* The version string for [tool_name] *) let version_string tool_name = if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then - Printf.sprintf "The CompCert %s, Release: %s, Build: %s, Tag: %s, Branch %s\n" + Printf.sprintf "The CompCert %s\nVersion: %s\nBuild: %s\nTag: %s\nBranch: %s\n" tool_name Version.version Version.buildnr Version.tag Version.branch else Printf.sprintf "The CompCert %s, version %s\n" tool_name Version.version @@ -25,16 +25,10 @@ let version_string tool_name = let print_version_and_exit tool_name () = Printf.printf "%s" (version_string tool_name); exit 0 -let version_file_string tool_name = - if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "This is CompCert %s,\nVersion: %s,\nBuild: %s,\nTag: %s,\nBranch: %s\n" - tool_name Version.version Version.buildnr Version.tag Version.branch - else - Printf.sprintf "The CompCert %s,\nversion %s\n" tool_name Version.version - +(* Print the version string to a file and exit the program *) let print_version_file_and_exit tool_name file = let oc = open_out_bin file in - output_string oc (version_file_string tool_name); + output_string oc (version_string tool_name); close_out_noerr oc; exit 0 @@ -93,7 +87,6 @@ let general_help = -v Print external commands before invoking them -timings Show the time spent in various compiler passes -version Print the version string and exit - -version-file Print version inforation to and exit -target Generate code for the given target -conf Read configuration from file @ Read command line options from -- cgit From 430263226793599834da40a39b2f82565338bd70 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 8 Jul 2020 16:51:22 +0200 Subject: Revert "Use the same version string." This reverts commit 1a01ad629109cdb60fddae3787e3a589d20e9790. --- driver/CommonOptions.ml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index e0e75e58..a2f249c1 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -16,7 +16,7 @@ open Commandline (* The version string for [tool_name] *) let version_string tool_name = if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then - Printf.sprintf "The CompCert %s\nVersion: %s\nBuild: %s\nTag: %s\nBranch: %s\n" + Printf.sprintf "The CompCert %s, Release: %s, Build: %s, Tag: %s, Branch %s\n" tool_name Version.version Version.buildnr Version.tag Version.branch else Printf.sprintf "The CompCert %s, version %s\n" tool_name Version.version @@ -25,10 +25,16 @@ let version_string tool_name = let print_version_and_exit tool_name () = Printf.printf "%s" (version_string tool_name); exit 0 -(* Print the version string to a file and exit the program *) +let version_file_string tool_name = + if Version.buildnr <> "" && Version.tag <> "" then + Printf.sprintf "This is CompCert %s,\nVersion: %s,\nBuild: %s,\nTag: %s,\nBranch: %s\n" + tool_name Version.version Version.buildnr Version.tag Version.branch + else + Printf.sprintf "The CompCert %s,\nversion %s\n" tool_name Version.version + let print_version_file_and_exit tool_name file = let oc = open_out_bin file in - output_string oc (version_string tool_name); + output_string oc (version_file_string tool_name); close_out_noerr oc; exit 0 @@ -87,6 +93,7 @@ let general_help = -v Print external commands before invoking them -timings Show the time spent in various compiler passes -version Print the version string and exit + -version-file Print version inforation to and exit -target Generate code for the given target -conf Read configuration from file @ Read command line options from -- cgit From a00de29bc143e758ed034018c3c528e873b9b3da Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 8 Jul 2020 17:58:51 +0200 Subject: Fix typo. --- driver/CommonOptions.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index a2f249c1..839bad1b 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -16,7 +16,7 @@ open Commandline (* The version string for [tool_name] *) let version_string tool_name = if Version.buildnr <> "" && Version.tag <> "" && Version.branch <> "" then - Printf.sprintf "The CompCert %s, Release: %s, Build: %s, Tag: %s, Branch %s\n" + Printf.sprintf "The CompCert %s, Release: %s, Build: %s, Tag: %s, Branch: %s\n" tool_name Version.version Version.buildnr Version.tag Version.branch else Printf.sprintf "The CompCert %s, version %s\n" tool_name Version.version -- cgit From 72be849e2a9bbe7e8a8438bf561c5a677a35c9e0 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 9 Jul 2020 10:55:44 +0200 Subject: No trailing commas for --version-file option. --- driver/CommonOptions.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index 839bad1b..5993c68d 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -27,7 +27,7 @@ let print_version_and_exit tool_name () = let version_file_string tool_name = if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "This is CompCert %s,\nVersion: %s,\nBuild: %s,\nTag: %s,\nBranch: %s\n" + Printf.sprintf "This is CompCert %s\nVersion: %s\nBuild: %s\nTag: %s\nBranch: %s\n" tool_name Version.version Version.buildnr Version.tag Version.branch else Printf.sprintf "The CompCert %s,\nversion %s\n" tool_name Version.version -- cgit From 13e0566dbdd8bf845d7c2a65ffefaaf460381e70 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 15 Jul 2020 09:49:40 +0200 Subject: Revised detection of menhirLib directory, continued (#365) This is a follow-up to commit 3b1f3dd5, which was wrong in that errors in a shell pipeline were not correctly detected. Fixes: #363 --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index d38deeec..0919f34e 100755 --- a/configure +++ b/configure @@ -592,11 +592,10 @@ case "$menhir_ver" in 20[0-9][0-9][0-9][0-9][0-9][0-9]) if test "$menhir_ver" -ge $MENHIR_REQUIRED; then echo "version $menhir_ver -- good!" - menhir_dir=$(ocamlfind query menhirLib 2>/dev/null \ - | tr -d '\r' | tr '\\' '/') || \ - menhir_dir=$(menhir --suggest-menhirLib \ - | tr -d '\r' | tr '\\' '/') || \ + menhir_dir=$(ocamlfind query menhirLib 2>/dev/null) || \ + menhir_dir=$(menhir --suggest-menhirLib) || \ menhir_dir="" + menhir_dir=$(echo "$menhir_dir" | tr -d '\r' | tr '\\' '/') if test ! -d "$menhir_dir"; then echo "Error: cannot determine the location of the Menhir API library." echo "This can be due to an incorrect Menhir package." @@ -852,6 +851,7 @@ CompCert configuration: Linker needs '-no-pie'........ $clinker_needs_no_pie Math library.................. $libmath Build command to use.......... $make + Menhir API library............ $menhir_dir Binaries installed in......... $bindirexp Runtime library provided...... $has_runtime_lib Library files installed in.... $libdirexp -- cgit From 6b854265e261b8c9e2e068364ef1405412b89063 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 15 Jul 2020 10:25:36 +0200 Subject: Bytecode-only build, continued If ocamlopt is not available, use ocamlc instead of ocamlopt to build auxiliary tools (tools/modorder, tools/ndfun). This is a follow-up to commit 9af28924. --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 5e97ebbf..ae095a09 100644 --- a/Makefile +++ b/Makefile @@ -191,9 +191,18 @@ documentation: $(FILES) $(filter-out doc/coq2html cparser/Parser.v, $^) tools/ndfun: tools/ndfun.ml +ifeq ($(OCAML_NATIVE_COMP),true) ocamlopt -o tools/ndfun str.cmxa tools/ndfun.ml +else + ocamlc -o tools/ndfun str.cma tools/ndfun.ml +endif + tools/modorder: tools/modorder.ml +ifeq ($(OCAML_NATIVE_COMP),true) ocamlopt -o tools/modorder str.cmxa tools/modorder.ml +else + ocamlc -o tools/modorder str.cma tools/modorder.ml +endif latexdoc: cd doc; $(COQDOC) --latex -o doc/doc.tex -g $(FILES) -- cgit From 72f78307cec2ac8fb33d657b118a930b2acfe8ad Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 15 Jul 2020 11:37:16 +0200 Subject: Added missing semicolon. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ae095a09..127ed5d2 100644 --- a/Makefile +++ b/Makefile @@ -247,7 +247,7 @@ compcert.config: Makefile.config echo "COMPCERT_SYSTEM=$(SYSTEM)"; \ echo "COMPCERT_VERSION=$(BUILDVERSION)"; \ echo "COMPCERT_BUILDNR=$(BUILDNR)"; \ - echo "COMPCERT_TAG=$(TAG)" \ + echo "COMPCERT_TAG=$(TAG)"; \ echo "COMPCERT_BRANCH=$(BRANCH)" \ ) > compcert.config -- cgit From b4c6087cd0faf3d165ca5450f7462b9fbe98796f Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 20 Jul 2020 11:55:35 +0200 Subject: Added error for redefined builtin. We check in the initial environment if a function is already defined to avoid redefinition of functions that are part of the builtin environment. --- cparser/Elab.ml | 2 ++ cparser/Env.ml | 3 +++ cparser/Env.mli | 1 + 3 files changed, 6 insertions(+) diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 4f2ddce7..b74e34d0 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -2624,6 +2624,8 @@ let elab_fundef genv spec name defs body loc = and structs and unions defined in the parameter list. *) let (fun_id, sto, inline, noret, ty, kr_params, genv, lenv) = elab_fundef_name genv spec name in + if Env.is_builtin fun_id.C.name then + error loc "definition of builtin function '%s'" fun_id.C.name; let s = fun_id.C.name in if sto = Storage_auto || sto = Storage_register then fatal_error loc "invalid storage class %s on function" diff --git a/cparser/Env.ml b/cparser/Env.ml index 4723a725..00806be1 100644 --- a/cparser/Env.ml +++ b/cparser/Env.ml @@ -316,6 +316,9 @@ let set_builtins blt = List.iter Init.add_typedef blt.builtin_typedefs; List.iter Init.add_function blt.builtin_functions +let is_builtin name = + ident_is_bound !Init.env name + (* Error reporting *) open Printf diff --git a/cparser/Env.mli b/cparser/Env.mli index 1baab68f..589a76c7 100644 --- a/cparser/Env.mli +++ b/cparser/Env.mli @@ -84,3 +84,4 @@ val initial: unit -> t val initial_identifiers: unit -> C.ident list val initial_declarations: unit -> C.globdecl list val set_builtins: C.builtins -> unit +val is_builtin : string -> bool -- cgit From 4adf6e3a967055df66fb815c92350dc835bb06dc Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 21 Jul 2020 13:17:38 +0200 Subject: Use the correct location for Slabaled in transform. --- cparser/Transform.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cparser/Transform.ml b/cparser/Transform.ml index 6774a9b6..a57d94c4 100644 --- a/cparser/Transform.ml +++ b/cparser/Transform.ml @@ -161,8 +161,8 @@ let stmt ~expr ?(decl = fun env decl -> assert false) env s = | Scontinue -> s | Sswitch(e, s1) -> {s with sdesc = Sswitch(expr s.sloc env Val e, stm s1)} - | Slabeled(lbl, s) -> - {s with sdesc = Slabeled(lbl, stm s)} + | Slabeled(lbl, s1) -> + {s with sdesc = Slabeled(lbl, stm s1)} | Sgoto lbl -> s | Sreturn None -> s | Sreturn (Some e) -> -- cgit From 3a1b0e98a09dd9688e8f45f9677b7ea25f4720bf Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 21 Jul 2020 17:09:45 +0200 Subject: Support __builtin_constant_p as in GCC and Clang (#367) Returns 1 if the argument is a constant expression, 0 otherwise. Closes: #366 --- cparser/Elab.ml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cparser/Elab.ml b/cparser/Elab.ml index b74e34d0..4bd0bdfa 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -1809,6 +1809,16 @@ let elab_expr ctx loc env a = (print_typ env) ty (print_typ env) ty' (print_typ env) ty' (print_typ env) ty; { edesc = ECall(ident, [b2; b3]); etyp = ty },env + | CALL(VARIABLE "__builtin_constant_p", al) -> + begin match al with + | [a1] -> + let b1,env = elab env a1 in + let v = if Ceval.is_constant_expr env b1 then 1L else 0L in + intconst v IInt, env + | _ -> + fatal_error "'__builtin_constant_p' expects one argument" + end + | CALL((VARIABLE "__builtin_sel" as a0), al) -> begin match al with | [a1; a2; a3] -> -- cgit From a8ce85adbf2863e98e5c24e9cc6f82947d4b3a29 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 21 Jul 2020 18:42:27 +0200 Subject: Support _Static_assert from C11 --- cparser/Cabs.v | 2 + cparser/Cabshelper.ml | 1 + cparser/Elab.ml | 30 +- cparser/Lexer.mll | 2 + cparser/Parser.vy | 19 +- cparser/handcrafted.messages | 2114 +++++++++++++++++++++--------------------- cparser/pre_parser.mly | 8 +- 7 files changed, 1116 insertions(+), 1060 deletions(-) diff --git a/cparser/Cabs.v b/cparser/Cabs.v index 5f12e8a1..ff046cba 100644 --- a/cparser/Cabs.v +++ b/cparser/Cabs.v @@ -92,6 +92,7 @@ with parameter := (* The optional expression is the bitfield *) with field_group := | Field_group : list spec_elem -> list (option name * option expression) -> loc -> field_group + | Field_group_static_assert : expression -> loc -> constant -> loc -> loc -> field_group (* The decl_type is in the order in which they are printed. Only the name of * the declared identifier is pulled out. *) @@ -197,6 +198,7 @@ Inductive definition := | FUNDEF : list spec_elem -> name -> list definition -> statement -> loc -> definition | DECDEF : init_name_group -> loc -> definition (* global variable(s), or function prototype *) | PRAGMA : string -> loc -> definition + | STATIC_ASSERT : expression -> loc -> constant -> loc -> loc -> definition (* ** statements diff --git a/cparser/Cabshelper.ml b/cparser/Cabshelper.ml index 22f3b3c7..7cffef08 100644 --- a/cparser/Cabshelper.ml +++ b/cparser/Cabshelper.ml @@ -44,6 +44,7 @@ let get_definitionloc (d : definition) : loc = | FUNDEF(_, _, _, _, l) -> l | DECDEF(_, l) -> l | PRAGMA(_, l) -> l + | STATIC_ASSERT(_, _, _, _, l) -> l let get_statementloc (s : statement) : loc = begin diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 4bd0bdfa..ab91ada2 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -459,6 +459,23 @@ let elab_simple_string loc wide chars = | CStr s -> s | _ -> error loc "cannot use wide string literal in 'asm'"; "" +(** Elaboration and checking of static assertions *) + +let elab_static_assert env exp loc_exp msg loc_msg loc = + let (exp, env) = !elab_expr_f loc_exp env exp in + match Ceval.integer_expr env exp with + | None -> + error loc_exp "expression in static assertion is not an integer constant" + | Some n -> + if n = 0L then begin + match elab_constant loc_msg msg with + | CStr s -> + error loc "static assertion failed: \"%s\"" s + | _ -> + (* This can happen with a wide string literal *) + error loc "static assertion failed (cannot display associated message)" + end + (** * Elaboration of type expressions, type specifiers, name declarations *) @@ -954,7 +971,9 @@ and elab_name_group loc env (spec, namelist) = (* Elaboration of a field group *) -and elab_field_group env (Field_group (spec, fieldlist, loc)) = +and elab_field_group env = function + +| Field_group (spec, fieldlist, loc) -> let fieldlist = List.map (function (None, x) -> (Name ("", JUSTBASE, [], loc), x) @@ -1019,6 +1038,10 @@ and elab_field_group env (Field_group (spec, fieldlist, loc)) = in (mmap2 elab_bitfield env' fieldlist names) +| Field_group_static_assert(exp, loc_exp, msg, loc_msg, loc) -> + elab_static_assert env exp loc_exp msg loc_msg loc; + ([], env) + (* Elaboration of a struct or union. C99 section 6.7.2.1 *) and elab_struct_or_union_info kind loc env members attrs = @@ -2839,6 +2862,11 @@ let elab_definition (for_loop: bool) (local: bool) (nonstatic_inline: bool) emit_elab env loc (Gpragma s); ([], env) + (* static assertion *) + | STATIC_ASSERT(exp, loc_exp, msg, loc_msg, loc) -> + elab_static_assert env exp loc_exp msg loc_msg loc; + ([], env) + (* Extended asm *) let elab_asm_operand ctx loc env (ASMOPERAND(label, wide, chars, e)) = diff --git a/cparser/Lexer.mll b/cparser/Lexer.mll index e44a330f..881d411a 100644 --- a/cparser/Lexer.mll +++ b/cparser/Lexer.mll @@ -35,6 +35,7 @@ let () = ("_Bool", fun loc -> UNDERSCORE_BOOL loc); ("_Complex", fun loc -> reserved_keyword loc "_Complex"); ("_Imaginary", fun loc -> reserved_keyword loc "_Imaginary"); + ("_Static_assert", fun loc -> STATIC_ASSERT loc); ("__alignof", fun loc -> ALIGNOF loc); ("__alignof__", fun loc -> ALIGNOF loc); ("__asm", fun loc -> ASM loc); @@ -577,6 +578,7 @@ and singleline_comment = parse | Pre_parser.SLASH loc -> loop (Parser.SLASH loc) | Pre_parser.STAR loc -> loop (Parser.STAR loc) | Pre_parser.STATIC loc -> loop (Parser.STATIC loc) + | Pre_parser.STATIC_ASSERT loc -> loop (Parser.STATIC_ASSERT loc) | Pre_parser.STRING_LITERAL (wide, str, loc) -> (* Merge consecutive string literals *) let rec doConcat wide str = diff --git a/cparser/Parser.vy b/cparser/Parser.vy index 03bfa590..93d84ecf 100644 --- a/cparser/Parser.vy +++ b/cparser/Parser.vy @@ -37,7 +37,7 @@ Require Cabs. STRUCT UNION ENUM UNDERSCORE_BOOL PACKED ALIGNAS ATTRIBUTE ASM %token CASE DEFAULT IF_ ELSE SWITCH WHILE DO FOR GOTO CONTINUE BREAK - RETURN BUILTIN_VA_ARG BUILTIN_OFFSETOF + RETURN BUILTIN_VA_ARG BUILTIN_OFFSETOF STATIC_ASSERT %token EOF @@ -55,6 +55,8 @@ Require Cabs. %type declaration_specifiers_typespec_opt %type init_declarator_list %type init_declarator +%type<(Cabs.expression * Cabs.loc) * (Cabs.constant * Cabs.loc) * Cabs.loc> + static_assert_declaration %type storage_class_specifier %type type_specifier struct_or_union_specifier enum_specifier %type struct_or_union @@ -343,6 +345,9 @@ declaration: { Cabs.DECDEF (fst decspec, rev' decls) (snd decspec) } | decspec = declaration_specifiers SEMICOLON { Cabs.DECDEF (fst decspec, []) (snd decspec) } +| asrt = static_assert_declaration + { let '((e, loc_e), (s, loc_s), loc) := asrt in + Cabs.STATIC_ASSERT e loc_e s loc_s loc } declaration_specifiers_typespec_opt: | storage = storage_class_specifier rest = declaration_specifiers_typespec_opt @@ -459,6 +464,10 @@ struct_declaration: (* Extension to C99 grammar needed to parse some GNU header files. *) | decspec = specifier_qualifier_list SEMICOLON { Cabs.Field_group (fst decspec) [(None,None)] (snd decspec) } +(* C11 static assertions *) +| asrt = static_assert_declaration + { let '((e, loc_e), (s, loc_s), loc) := asrt in + Cabs.Field_group_static_assert e loc_e s loc_s loc } specifier_qualifier_list: | typ = type_specifier rest = specifier_qualifier_list @@ -749,6 +758,14 @@ designator: | DOT id = OTHER_NAME { Cabs.INFIELD_INIT (fst id) } +(* C11 6.7.10 *) + +static_assert_declaration: +| loc = STATIC_ASSERT LPAREN expr = constant_expression + COMMA str = STRING_LITERAL RPAREN SEMICOLON + { let '((wide, chars), locs) := str in + (expr, (Cabs.CONST_STRING wide chars, locs), loc) } + (* 6.8 *) statement_dangerous: | stmt = labeled_statement(statement_dangerous) diff --git a/cparser/handcrafted.messages b/cparser/handcrafted.messages index 6d972439..a5f365dc 100644 --- a/cparser/handcrafted.messages +++ b/cparser/handcrafted.messages @@ -179,22 +179,22 @@ # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN INT XOR_ASSIGN +translation_unit_file: ALIGNAS LPAREN INT XOR_ASSIGN ## -## Ends in an error in state: 314. +## Ends in an error in state: 322. ## ## attribute_specifier -> ALIGNAS LPAREN type_name . RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ALIGNAS LPAREN type_name +## ALIGNAS LPAREN type_name ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). ## In state 67, spurious reduction of production specifier_qualifier_list(type_name) -> type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) -## In state 306, spurious reduction of production option(abstract_declarator(type_name)) -> -## In state 312, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) +## In state 314, spurious reduction of production option(abstract_declarator(type_name)) -> +## In state 320, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) ## # Maybe the type name was not complete, but we have reduced anyway @@ -212,40 +212,40 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ ALIGNOF LPAREN VOID XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ ALIGNOF LPAREN VOID XOR_ASSIGN ## -## Ends in an error in state: 304. +## Ends in an error in state: 312. ## ## unary_expression -> ALIGNOF LPAREN type_name . RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## ALIGNOF LPAREN type_name +## ALIGNOF LPAREN type_name ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). ## In state 67, spurious reduction of production specifier_qualifier_list(type_name) -> type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) -## In state 306, spurious reduction of production option(abstract_declarator(type_name)) -> -## In state 312, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) +## In state 314, spurious reduction of production option(abstract_declarator(type_name)) -> +## In state 320, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ SIZEOF LPAREN VOID XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ SIZEOF LPAREN VOID XOR_ASSIGN ## -## Ends in an error in state: 388. +## Ends in an error in state: 396. ## ## postfix_expression -> LPAREN type_name . RPAREN LBRACE initializer_list option(COMMA) RBRACE [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## unary_expression -> SIZEOF LPAREN type_name . RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## SIZEOF LPAREN type_name +## SIZEOF LPAREN type_name ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). ## In state 67, spurious reduction of production specifier_qualifier_list(type_name) -> type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) -## In state 306, spurious reduction of production option(abstract_declarator(type_name)) -> -## In state 312, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) +## In state 314, spurious reduction of production option(abstract_declarator(type_name)) -> +## In state 320, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) ## Ill-formed use of $2. @@ -256,22 +256,22 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG LPAREN PRE_NAME VAR_NAME COMMA VOID XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG LPAREN PRE_NAME VAR_NAME COMMA VOID XOR_ASSIGN ## -## Ends in an error in state: 333. +## Ends in an error in state: 341. ## ## postfix_expression -> BUILTIN_VA_ARG LPAREN assignment_expression COMMA type_name . RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_VA_ARG LPAREN assignment_expression COMMA type_name +## BUILTIN_VA_ARG LPAREN assignment_expression COMMA type_name ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). ## In state 67, spurious reduction of production specifier_qualifier_list(type_name) -> type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) -## In state 306, spurious reduction of production option(abstract_declarator(type_name)) -> -## In state 312, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) +## In state 314, spurious reduction of production option(abstract_declarator(type_name)) -> +## In state 320, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) ## Ill-formed use of __builtin_va_arg. @@ -282,22 +282,22 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ INC LPAREN VOID XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ INC LPAREN VOID XOR_ASSIGN ## -## Ends in an error in state: 363. +## Ends in an error in state: 371. ## ## postfix_expression -> LPAREN type_name . RPAREN LBRACE initializer_list option(COMMA) RBRACE [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN type_name +## LPAREN type_name ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). ## In state 67, spurious reduction of production specifier_qualifier_list(type_name) -> type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) -## In state 306, spurious reduction of production option(abstract_declarator(type_name)) -> -## In state 312, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) +## In state 314, spurious reduction of production option(abstract_declarator(type_name)) -> +## In state 320, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) ## # gcc simply says it expects a closing parenthesis, @@ -311,23 +311,23 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN VOID XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN VOID XOR_ASSIGN ## -## Ends in an error in state: 385. +## Ends in an error in state: 393. ## ## cast_expression -> LPAREN type_name . RPAREN cast_expression [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## postfix_expression -> LPAREN type_name . RPAREN LBRACE initializer_list option(COMMA) RBRACE [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN type_name +## LPAREN type_name ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). ## In state 67, spurious reduction of production specifier_qualifier_list(type_name) -> type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) -## In state 306, spurious reduction of production option(abstract_declarator(type_name)) -> -## In state 312, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) +## In state 314, spurious reduction of production option(abstract_declarator(type_name)) -> +## In state 320, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) ## # gcc and clang say they expect a closing parenthesis. @@ -339,35 +339,35 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: ALIGNAS LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 316. +## Ends in an error in state: 324. ## ## argument_expression_list -> argument_expression_list . COMMA assignment_expression [ RPAREN COMMA ] ## attribute_specifier -> ALIGNAS LPAREN argument_expression_list . RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ALIGNAS LPAREN argument_expression_list +## ALIGNAS LPAREN argument_expression_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 230, spurious reduction of production argument_expression_list -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 155, spurious reduction of production argument_expression_list -> assignment_expression ## # We are trying to recognize an alignas specifier. @@ -389,27 +389,27 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN INT LBRACK RPAREN +translation_unit_file: ALIGNAS LPAREN INT LBRACK RPAREN ## -## Ends in an error in state: 151. +## Ends in an error in state: 248. ## ## direct_abstract_declarator -> option(direct_abstract_declarator) LBRACK option(type_qualifier_list) . optional(assignment_expression,RBRACK) [ RPAREN LPAREN LBRACK COMMA ] ## type_qualifier_list -> option(type_qualifier_list) . type_qualifier_noattr [ VOLATILE TILDE STRING_LITERAL STAR SIZEOF RESTRICT RBRACK PRE_NAME PLUS PACKED MINUS LPAREN INC DEC CONSTANT CONST BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG ATTRIBUTE AND ALIGNOF ALIGNAS ] ## type_qualifier_list -> option(type_qualifier_list) . attribute_specifier [ VOLATILE TILDE STRING_LITERAL STAR SIZEOF RESTRICT RBRACK PRE_NAME PLUS PACKED MINUS LPAREN INC DEC CONSTANT CONST BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## option(direct_abstract_declarator) LBRACK option(type_qualifier_list) +## option(direct_abstract_declarator) LBRACK option(type_qualifier_list) ## -translation_unit_file: INT PRE_NAME VAR_NAME LBRACK RPAREN +translation_unit_file: INT PRE_NAME VAR_NAME LBRACK RPAREN ## -## Ends in an error in state: 257. +## Ends in an error in state: 265. ## ## direct_declarator -> direct_declarator LBRACK option(type_qualifier_list) . optional(assignment_expression,RBRACK) [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## type_qualifier_list -> option(type_qualifier_list) . type_qualifier_noattr [ VOLATILE TILDE STRING_LITERAL STAR SIZEOF RESTRICT RBRACK PRE_NAME PLUS PACKED MINUS LPAREN INC DEC CONSTANT CONST BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG ATTRIBUTE AND ALIGNOF ALIGNAS ] ## type_qualifier_list -> option(type_qualifier_list) . attribute_specifier [ VOLATILE TILDE STRING_LITERAL STAR SIZEOF RESTRICT RBRACK PRE_NAME PLUS PACKED MINUS LPAREN INC DEC CONSTANT CONST BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## direct_declarator LBRACK option(type_qualifier_list) +## direct_declarator LBRACK option(type_qualifier_list) ## # We are trying to recognize an array declarator. @@ -434,32 +434,32 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN INT LPAREN INT COMMA ELLIPSIS XOR_ASSIGN +translation_unit_file: ALIGNAS LPAREN INT LPAREN INT COMMA ELLIPSIS XOR_ASSIGN ## -## Ends in an error in state: 268. +## Ends in an error in state: 276. ## ## direct_abstract_declarator -> LPAREN option(context_parameter_type_list) . RPAREN [ RPAREN LPAREN LBRACK COMMA ] ## ## The known suffix of the stack is as follows: -## LPAREN option(context_parameter_type_list) +## LPAREN option(context_parameter_type_list) ## -translation_unit_file: ALIGNAS LPAREN INT LBRACK RBRACK LPAREN INT COMMA ELLIPSIS XOR_ASSIGN +translation_unit_file: ALIGNAS LPAREN INT LBRACK RBRACK LPAREN INT COMMA ELLIPSIS XOR_ASSIGN ## -## Ends in an error in state: 251. +## Ends in an error in state: 259. ## ## direct_abstract_declarator -> direct_abstract_declarator LPAREN option(context_parameter_type_list) . RPAREN [ RPAREN LPAREN LBRACK COMMA ] ## ## The known suffix of the stack is as follows: -## direct_abstract_declarator LPAREN option(context_parameter_type_list) +## direct_abstract_declarator LPAREN option(context_parameter_type_list) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT COMMA ELLIPSIS XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT COMMA ELLIPSIS XOR_ASSIGN ## -## Ends in an error in state: 285. +## Ends in an error in state: 293. ## ## direct_declarator -> direct_declarator LPAREN context_parameter_type_list . RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## direct_declarator LPAREN context_parameter_type_list +## direct_declarator LPAREN context_parameter_type_list ## # Unlikely error, since only the ELLIPSIS allows us to tell that @@ -469,20 +469,20 @@ At this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN INT LPAREN LPAREN RPAREN COMMA +translation_unit_file: ALIGNAS LPAREN INT LPAREN LPAREN RPAREN COMMA ## -## Ends in an error in state: 266. +## Ends in an error in state: 274. ## ## direct_abstract_declarator -> LPAREN save_context abstract_declarator(type_name) . RPAREN [ RPAREN LPAREN LBRACK COMMA ] ## ## The known suffix of the stack is as follows: -## LPAREN save_context abstract_declarator(type_name) +## LPAREN save_context abstract_declarator(type_name) ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 259, spurious reduction of production abstract_declarator(type_name) -> direct_abstract_declarator +## In state 267, spurious reduction of production abstract_declarator(type_name) -> direct_abstract_declarator ## # # The first LPAREN in this example must be the beginning of an abstract_declarator. @@ -511,15 +511,15 @@ At this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN INT LPAREN XOR_ASSIGN +translation_unit_file: ALIGNAS LPAREN INT LPAREN XOR_ASSIGN ## -## Ends in an error in state: 307. +## Ends in an error in state: 315. ## ## direct_abstract_declarator -> LPAREN . save_context abstract_declarator(type_name) RPAREN [ RPAREN LPAREN LBRACK COMMA ] ## direct_abstract_declarator -> LPAREN . option(context_parameter_type_list) RPAREN [ RPAREN LPAREN LBRACK COMMA ] ## ## The known suffix of the stack is as follows: -## LPAREN +## LPAREN ## # gcc and clang both say they want a closing parenthesis. @@ -534,16 +534,16 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT LPAREN XOR_ASSIGN ## -## Ends in an error in state: 145. +## Ends in an error in state: 242. ## ## direct_abstract_declarator -> LPAREN . save_context abstract_declarator(type_name) RPAREN [ RPAREN LPAREN LBRACK COMMA ] ## direct_abstract_declarator -> LPAREN . option(context_parameter_type_list) RPAREN [ RPAREN LPAREN LBRACK COMMA ] ## direct_declarator -> LPAREN . save_context declarator RPAREN [ RPAREN PACKED LPAREN LBRACK COMMA ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## LPAREN +## LPAREN ## # Analogous to the above, but has a third item. @@ -557,16 +557,16 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN VOLATILE ADD_ASSIGN +translation_unit_file: ALIGNAS LPAREN VOLATILE ADD_ASSIGN ## -## Ends in an error in state: 299. +## Ends in an error in state: 307. ## ## option(type_qualifier_list) -> type_qualifier_list . [ VOLATILE RESTRICT PACKED CONST ATTRIBUTE ALIGNAS ] ## specifier_qualifier_list(type_name) -> type_qualifier_list . typedef_name option(type_qualifier_list) [ STAR RPAREN LPAREN LBRACK COMMA ] ## specifier_qualifier_list(type_name) -> type_qualifier_list . type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) [ STAR RPAREN LPAREN LBRACK COMMA ] ## ## The known suffix of the stack is as follows: -## type_qualifier_list +## type_qualifier_list ## # We are trying to recognize a specifier-qualifier-list, and have not yet seen @@ -582,7 +582,7 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN XOR_ASSIGN +translation_unit_file: ALIGNAS LPAREN XOR_ASSIGN ## ## Ends in an error in state: 61. ## @@ -590,7 +590,7 @@ translation_unit_file: ALIGNAS LPAREN XOR_ASSIGN ## attribute_specifier -> ALIGNAS LPAREN . type_name RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ALIGNAS LPAREN +## ALIGNAS LPAREN ## # This one seems easy. We have recognized ALIGNAS LPAREN, and nothing that makes sense beyond that. @@ -604,7 +604,7 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS XOR_ASSIGN +translation_unit_file: ALIGNAS XOR_ASSIGN ## ## Ends in an error in state: 60. ## @@ -612,7 +612,7 @@ translation_unit_file: ALIGNAS XOR_ASSIGN ## attribute_specifier -> ALIGNAS . LPAREN type_name RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ALIGNAS +## ALIGNAS ## # Fingers in the nose. @@ -622,14 +622,14 @@ At this point, an opening parenthesis '(' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN COMMA XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN LPAREN COMMA XOR_ASSIGN ## -## Ends in an error in state: 345. +## Ends in an error in state: 353. ## ## gcc_attribute_list -> gcc_attribute_list COMMA . gcc_attribute [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## gcc_attribute_list COMMA +## gcc_attribute_list COMMA ## # We are expecting a gcc_attribute. This symbol is nullable, so @@ -644,14 +644,14 @@ At this point, a gcc attribute is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN RPAREN XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN LPAREN RPAREN XOR_ASSIGN ## -## Ends in an error in state: 343. +## Ends in an error in state: 351. ## ## attribute_specifier -> ATTRIBUTE LPAREN LPAREN gcc_attribute_list RPAREN . RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ATTRIBUTE LPAREN LPAREN gcc_attribute_list RPAREN +## ATTRIBUTE LPAREN LPAREN gcc_attribute_list RPAREN ## Ill-formed attribute specifier. @@ -659,15 +659,15 @@ At this point, a second closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN RPAREN XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN RPAREN XOR_ASSIGN ## -## Ends in an error in state: 342. +## Ends in an error in state: 350. ## ## attribute_specifier -> ATTRIBUTE LPAREN LPAREN gcc_attribute_list . RPAREN RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## gcc_attribute_list -> gcc_attribute_list . COMMA gcc_attribute [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## ATTRIBUTE LPAREN LPAREN gcc_attribute_list +## ATTRIBUTE LPAREN LPAREN gcc_attribute_list ## # We have a seen a (non-empty) attribute list, so we expect either @@ -682,35 +682,35 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME COMMA PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME COMMA PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 338. +## Ends in an error in state: 346. ## ## argument_expression_list -> argument_expression_list . COMMA assignment_expression [ RPAREN COMMA ] ## gcc_attribute -> gcc_attribute_word LPAREN typedef_name COMMA argument_expression_list . RPAREN [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## gcc_attribute_word LPAREN typedef_name COMMA argument_expression_list +## gcc_attribute_word LPAREN typedef_name COMMA argument_expression_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 230, spurious reduction of production argument_expression_list -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 155, spurious reduction of production argument_expression_list -> assignment_expression ## # We know for sure that we are parsing a gcc attribute. @@ -726,14 +726,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME COMMA XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 337. +## Ends in an error in state: 345. ## ## gcc_attribute -> gcc_attribute_word LPAREN typedef_name COMMA . argument_expression_list RPAREN [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## gcc_attribute_word LPAREN typedef_name COMMA +## gcc_attribute_word LPAREN typedef_name COMMA ## # gcc/clang agree. @@ -743,14 +743,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 336. +## Ends in an error in state: 344. ## ## gcc_attribute -> gcc_attribute_word LPAREN typedef_name . COMMA argument_expression_list RPAREN [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## gcc_attribute_word LPAREN typedef_name +## gcc_attribute_word LPAREN typedef_name ## # gcc and clang complain about the TYPEDEF_NAME, not sure why. @@ -760,7 +760,7 @@ At this point, a comma ',' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN XOR_ASSIGN ## ## Ends in an error in state: 47. ## @@ -768,7 +768,7 @@ translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME LPAREN XOR_ASSI ## gcc_attribute -> gcc_attribute_word LPAREN . typedef_name COMMA argument_expression_list RPAREN [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## gcc_attribute_word LPAREN +## gcc_attribute_word LPAREN ## # gcc and clang just say they expect an expression. @@ -780,7 +780,7 @@ At this point, a list of expressions is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME XOR_ASSIGN ## ## Ends in an error in state: 46. ## @@ -789,7 +789,7 @@ translation_unit_file: ATTRIBUTE LPAREN LPAREN PRE_NAME VAR_NAME XOR_ASSIGN ## gcc_attribute -> gcc_attribute_word . LPAREN typedef_name COMMA argument_expression_list RPAREN [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## gcc_attribute_word +## gcc_attribute_word ## # gcc and clang say they expect a closing parenthesis (as usual). @@ -806,14 +806,14 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN LPAREN XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN LPAREN XOR_ASSIGN ## ## Ends in an error in state: 39. ## ## attribute_specifier -> ATTRIBUTE LPAREN LPAREN . gcc_attribute_list RPAREN RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ATTRIBUTE LPAREN LPAREN +## ATTRIBUTE LPAREN LPAREN ## # A non-empty attribute list is expected. @@ -828,14 +828,14 @@ At this point, a gcc attribute is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE LPAREN XOR_ASSIGN +translation_unit_file: ATTRIBUTE LPAREN XOR_ASSIGN ## ## Ends in an error in state: 38. ## ## attribute_specifier -> ATTRIBUTE LPAREN . LPAREN gcc_attribute_list RPAREN RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ATTRIBUTE LPAREN +## ATTRIBUTE LPAREN ## Ill-formed gcc attribute specifier. @@ -843,14 +843,14 @@ At this point, a second opening parenthesis '(' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ATTRIBUTE XOR_ASSIGN +translation_unit_file: ATTRIBUTE XOR_ASSIGN ## ## Ends in an error in state: 37. ## ## attribute_specifier -> ATTRIBUTE . LPAREN LPAREN gcc_attribute_list RPAREN RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ATTRIBUTE +## ATTRIBUTE ## Ill-formed gcc attribute specifier. @@ -858,15 +858,15 @@ At this point, two opening parentheses '((' are expected. # ------------------------------------------------------------------------------ -translation_unit_file: ENUM LBRACE PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: ENUM LBRACE PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 353. +## Ends in an error in state: 361. ## ## enumerator_list -> enumerator_list COMMA . declare_varname(enumerator) [ RBRACE COMMA ] ## option(COMMA) -> COMMA . [ RBRACE ] ## ## The known suffix of the stack is as follows: -## enumerator_list COMMA +## enumerator_list COMMA ## # We omit the possibility of a closing brace. @@ -879,36 +879,36 @@ At this point, an enumerator is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ENUM LBRACE PRE_NAME VAR_NAME EQ CONSTANT SEMICOLON +translation_unit_file: ENUM LBRACE PRE_NAME VAR_NAME EQ CONSTANT SEMICOLON ## -## Ends in an error in state: 352. +## Ends in an error in state: 360. ## ## enum_specifier -> ENUM attribute_specifier_list option(other_identifier) LBRACE enumerator_list . option(COMMA) RBRACE [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK INT INLINE FLOAT EXTERN ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## enumerator_list -> enumerator_list . COMMA declare_varname(enumerator) [ RBRACE COMMA ] ## ## The known suffix of the stack is as follows: -## ENUM attribute_specifier_list option(other_identifier) LBRACE enumerator_list +## ENUM attribute_specifier_list option(other_identifier) LBRACE enumerator_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 154, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 357, spurious reduction of production enumerator -> enumeration_constant EQ conditional_expression -## In state 354, spurious reduction of production declare_varname(enumerator) -> enumerator -## In state 361, spurious reduction of production enumerator_list -> declare_varname(enumerator) +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 79, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 365, spurious reduction of production enumerator -> enumeration_constant EQ conditional_expression +## In state 362, spurious reduction of production declare_varname(enumerator) -> enumerator +## In state 369, spurious reduction of production enumerator_list -> declare_varname(enumerator) ## # # At first sight, it seems that the last enumerator that we have recognized @@ -937,14 +937,14 @@ then at this point, a closing brace '}' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ENUM LBRACE PRE_NAME VAR_NAME EQ XOR_ASSIGN +translation_unit_file: ENUM LBRACE PRE_NAME VAR_NAME EQ XOR_ASSIGN ## -## Ends in an error in state: 356. +## Ends in an error in state: 364. ## ## enumerator -> enumeration_constant EQ . conditional_expression [ RBRACE COMMA ] ## ## The known suffix of the stack is as follows: -## enumeration_constant EQ +## enumeration_constant EQ ## Ill-formed enumeration specifier. @@ -952,15 +952,15 @@ At this point, a constant expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ENUM LBRACE PRE_NAME VAR_NAME XOR_ASSIGN +translation_unit_file: ENUM LBRACE PRE_NAME VAR_NAME XOR_ASSIGN ## -## Ends in an error in state: 355. +## Ends in an error in state: 363. ## ## enumerator -> enumeration_constant . [ RBRACE COMMA ] ## enumerator -> enumeration_constant . EQ conditional_expression [ RBRACE COMMA ] ## ## The known suffix of the stack is as follows: -## enumeration_constant +## enumeration_constant ## # Here, both clang and gcc give an incomplete diagnostic message. @@ -973,14 +973,14 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: ENUM LBRACE XOR_ASSIGN +translation_unit_file: ENUM LBRACE XOR_ASSIGN ## -## Ends in an error in state: 350. +## Ends in an error in state: 358. ## ## enum_specifier -> ENUM attribute_specifier_list option(other_identifier) LBRACE . enumerator_list option(COMMA) RBRACE [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK INT INLINE FLOAT EXTERN ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ENUM attribute_specifier_list option(other_identifier) LBRACE +## ENUM attribute_specifier_list option(other_identifier) LBRACE ## # gcc says it expects an identifier. @@ -991,15 +991,15 @@ At this point, an enumerator is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ENUM XOR_ASSIGN +translation_unit_file: ENUM XOR_ASSIGN ## -## Ends in an error in state: 348. +## Ends in an error in state: 356. ## ## enum_specifier -> ENUM attribute_specifier_list . option(other_identifier) LBRACE enumerator_list option(COMMA) RBRACE [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK INT INLINE FLOAT EXTERN ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## enum_specifier -> ENUM attribute_specifier_list . general_identifier [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK INT INLINE FLOAT EXTERN ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ENUM attribute_specifier_list +## ENUM attribute_specifier_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an @@ -1018,16 +1018,16 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ ALIGNOF LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ ALIGNOF LPAREN XOR_ASSIGN ## ## Ends in an error in state: 65. ## ## unary_expression -> ALIGNOF LPAREN . type_name RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## ALIGNOF LPAREN +## ALIGNOF LPAREN ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ SIZEOF LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ SIZEOF LPAREN XOR_ASSIGN ## ## Ends in an error in state: 28. ## @@ -1036,7 +1036,7 @@ translation_unit_file: INT PRE_NAME VAR_NAME EQ SIZEOF LPAREN XOR_ASSIGN ## unary_expression -> SIZEOF LPAREN . type_name RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## SIZEOF LPAREN +## SIZEOF LPAREN ## # Tricky because we could be looking at the beginning of a compound @@ -1051,14 +1051,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ ALIGNOF XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ ALIGNOF XOR_ASSIGN ## ## Ends in an error in state: 64. ## ## unary_expression -> ALIGNOF . LPAREN type_name RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## ALIGNOF +## ALIGNOF ## Ill-formed use of $0. @@ -1067,7 +1067,7 @@ followed with a type name. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ SIZEOF XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ SIZEOF XOR_ASSIGN ## ## Ends in an error in state: 23. ## @@ -1075,7 +1075,7 @@ translation_unit_file: INT PRE_NAME VAR_NAME EQ SIZEOF XOR_ASSIGN ## unary_expression -> SIZEOF . LPAREN type_name RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## SIZEOF +## SIZEOF ## # Let's not reveal that sizeof can be used without parentheses. @@ -1089,33 +1089,33 @@ followed with an expression or a type name. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 331. +## Ends in an error in state: 339. ## ## postfix_expression -> BUILTIN_VA_ARG LPAREN assignment_expression . COMMA type_name RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_VA_ARG LPAREN assignment_expression +## BUILTIN_VA_ARG LPAREN assignment_expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression ## Ill-formed use of $2. @@ -1126,14 +1126,14 @@ then at this point, a comma ',' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG LPAREN PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG LPAREN PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 332. +## Ends in an error in state: 340. ## ## postfix_expression -> BUILTIN_VA_ARG LPAREN assignment_expression COMMA . type_name RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_VA_ARG LPAREN assignment_expression COMMA +## BUILTIN_VA_ARG LPAREN assignment_expression COMMA ## Ill-formed use of $3. @@ -1141,14 +1141,14 @@ At this point, a type name is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG LPAREN XOR_ASSIGN ## ## Ends in an error in state: 51. ## ## postfix_expression -> BUILTIN_VA_ARG LPAREN . assignment_expression COMMA type_name RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_VA_ARG LPAREN +## BUILTIN_VA_ARG LPAREN ## Ill-formed use of $1. @@ -1156,14 +1156,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ BUILTIN_VA_ARG XOR_ASSIGN ## ## Ends in an error in state: 50. ## ## postfix_expression -> BUILTIN_VA_ARG . LPAREN assignment_expression COMMA type_name RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_VA_ARG +## BUILTIN_VA_ARG ## Ill-formed use of $0. @@ -1171,23 +1171,23 @@ At this point, an opening parenthesis '(' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ DEC XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ DEC XOR_ASSIGN ## ## Ends in an error in state: 48. ## ## unary_expression -> DEC . unary_expression [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## DEC +## DEC ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ INC XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ INC XOR_ASSIGN ## ## Ends in an error in state: 33. ## ## unary_expression -> INC . unary_expression [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## INC +## INC ## Ill-formed expression. @@ -1195,14 +1195,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ INC LPAREN INT RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ INC LPAREN INT RPAREN XOR_ASSIGN ## -## Ends in an error in state: 364. +## Ends in an error in state: 372. ## ## postfix_expression -> LPAREN type_name RPAREN . LBRACE initializer_list option(COMMA) RBRACE [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN type_name RPAREN +## LPAREN type_name RPAREN ## # Here, we seem to be certain that this must be the beginning of a @@ -1226,7 +1226,7 @@ If this is intended to be the beginning of a cast expression, # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ INC LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ INC LPAREN XOR_ASSIGN ## ## Ends in an error in state: 34. ## @@ -1234,7 +1234,7 @@ translation_unit_file: INT PRE_NAME VAR_NAME EQ INC LPAREN XOR_ASSIGN ## primary_expression -> LPAREN . expression RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN +## LPAREN ## # gcc and clang expect an expression. @@ -1247,35 +1247,35 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 382. +## Ends in an error in state: 390. ## ## expression -> expression . COMMA assignment_expression [ RPAREN COMMA ] ## primary_expression -> LPAREN expression . RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN expression +## LPAREN expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## # Since we are saying "if this expression is complete", @@ -1291,36 +1291,36 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN INT RPAREN LBRACE PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN INT RPAREN LBRACE PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 379. +## Ends in an error in state: 387. ## ## initializer_list -> initializer_list . COMMA option(designation) c_initializer [ RBRACE COMMA ] ## postfix_expression -> LPAREN type_name RPAREN LBRACE initializer_list . option(COMMA) RBRACE [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN type_name RPAREN LBRACE initializer_list +## LPAREN type_name RPAREN LBRACE initializer_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 372, spurious reduction of production c_initializer -> assignment_expression -## In state 378, spurious reduction of production initializer_list -> option(designation) c_initializer +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 380, spurious reduction of production c_initializer -> assignment_expression +## In state 386, spurious reduction of production initializer_list -> option(designation) c_initializer ## # Let's ignore the fact that a comma can precede a closing brace. @@ -1333,14 +1333,14 @@ then at this point, a closing brace '}' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN INT RPAREN LBRACE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN INT RPAREN LBRACE XOR_ASSIGN ## -## Ends in an error in state: 365. +## Ends in an error in state: 373. ## ## postfix_expression -> LPAREN type_name RPAREN LBRACE . initializer_list option(COMMA) RBRACE [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN type_name RPAREN LBRACE +## LPAREN type_name RPAREN LBRACE ## # gcc and clang say an expression is expected, which is incomplete. @@ -1350,15 +1350,15 @@ At this point, an initializer is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN INT RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN INT RPAREN XOR_ASSIGN ## -## Ends in an error in state: 386. +## Ends in an error in state: 394. ## ## cast_expression -> LPAREN type_name RPAREN . cast_expression [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## postfix_expression -> LPAREN type_name RPAREN . LBRACE initializer_list option(COMMA) RBRACE [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN type_name RPAREN +## LPAREN type_name RPAREN ## # clang and gcc expect an expression. @@ -1372,7 +1372,7 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN XOR_ASSIGN ## ## Ends in an error in state: 30. ## @@ -1381,7 +1381,7 @@ translation_unit_file: INT PRE_NAME VAR_NAME EQ LPAREN XOR_ASSIGN ## primary_expression -> LPAREN . expression RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## LPAREN +## LPAREN ## # clang and gcc expect an expression. @@ -1394,14 +1394,14 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ TILDE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ TILDE XOR_ASSIGN ## -## Ends in an error in state: 153. +## Ends in an error in state: 78. ## ## unary_expression -> unary_operator . cast_expression [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LEQ LEFT_ASSIGN LEFT HAT GT GEQ EQEQ EQ DIV_ASSIGN COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## unary_operator +## unary_operator ## # clang and gcc expect an expression. @@ -1411,95 +1411,95 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME AND XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME AND XOR_ASSIGN ## -## Ends in an error in state: 213. +## Ends in an error in state: 138. ## ## and_expression -> and_expression AND . equality_expression [ SEMICOLON RPAREN RBRACK RBRACE QUESTION HAT COMMA COLON BARBAR BAR ANDAND AND ] ## ## The known suffix of the stack is as follows: -## and_expression AND +## and_expression AND ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME ANDAND XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME ANDAND XOR_ASSIGN ## -## Ends in an error in state: 202. +## Ends in an error in state: 127. ## ## logical_and_expression -> logical_and_expression ANDAND . inclusive_or_expression [ SEMICOLON RPAREN RBRACK RBRACE QUESTION COMMA COLON BARBAR ANDAND ] ## ## The known suffix of the stack is as follows: -## logical_and_expression ANDAND +## logical_and_expression ANDAND ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME BAR XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME BAR XOR_ASSIGN ## -## Ends in an error in state: 204. +## Ends in an error in state: 129. ## ## inclusive_or_expression -> inclusive_or_expression BAR . exclusive_or_expression [ SEMICOLON RPAREN RBRACK RBRACE QUESTION COMMA COLON BARBAR BAR ANDAND ] ## ## The known suffix of the stack is as follows: -## inclusive_or_expression BAR +## inclusive_or_expression BAR ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME BARBAR XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME BARBAR XOR_ASSIGN ## -## Ends in an error in state: 225. +## Ends in an error in state: 150. ## ## logical_or_expression -> logical_or_expression BARBAR . logical_and_expression [ SEMICOLON RPAREN RBRACK RBRACE QUESTION COMMA COLON BARBAR ] ## ## The known suffix of the stack is as follows: -## logical_or_expression BARBAR +## logical_or_expression BARBAR ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME HAT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME HAT XOR_ASSIGN ## -## Ends in an error in state: 206. +## Ends in an error in state: 131. ## ## exclusive_or_expression -> exclusive_or_expression HAT . and_expression [ SEMICOLON RPAREN RBRACK RBRACE QUESTION HAT COMMA COLON BARBAR BAR ANDAND ] ## ## The known suffix of the stack is as follows: -## exclusive_or_expression HAT +## exclusive_or_expression HAT ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LT XOR_ASSIGN ## -## Ends in an error in state: 196. +## Ends in an error in state: 121. ## ## relational_expression -> relational_expression relational_operator . shift_expression [ SEMICOLON RPAREN RBRACK RBRACE QUESTION NEQ LT LEQ HAT GT GEQ EQEQ COMMA COLON BARBAR BAR ANDAND AND ] ## ## The known suffix of the stack is as follows: -## relational_expression relational_operator +## relational_expression relational_operator ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME NEQ XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME NEQ XOR_ASSIGN ## -## Ends in an error in state: 210. +## Ends in an error in state: 135. ## ## equality_expression -> equality_expression equality_operator . relational_expression [ SEMICOLON RPAREN RBRACK RBRACE QUESTION NEQ HAT EQEQ COMMA COLON BARBAR BAR ANDAND AND ] ## ## The known suffix of the stack is as follows: -## equality_expression equality_operator +## equality_expression equality_operator ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME PLUS XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME PLUS XOR_ASSIGN ## -## Ends in an error in state: 189. +## Ends in an error in state: 114. ## ## additive_expression -> additive_expression additive_operator . multiplicative_expression [ SEMICOLON RPAREN RIGHT RBRACK RBRACE QUESTION PLUS NEQ MINUS LT LEQ LEFT HAT GT GEQ EQEQ COMMA COLON BARBAR BAR ANDAND AND ] ## ## The known suffix of the stack is as follows: -## additive_expression additive_operator +## additive_expression additive_operator ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME RIGHT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME RIGHT XOR_ASSIGN ## -## Ends in an error in state: 178. +## Ends in an error in state: 103. ## ## shift_expression -> shift_expression shift_operator . additive_expression [ SEMICOLON RPAREN RIGHT RBRACK RBRACE QUESTION NEQ LT LEQ LEFT HAT GT GEQ EQEQ COMMA COLON BARBAR BAR ANDAND AND ] ## ## The known suffix of the stack is as follows: -## shift_expression shift_operator +## shift_expression shift_operator ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME STAR XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME STAR XOR_ASSIGN ## -## Ends in an error in state: 183. +## Ends in an error in state: 108. ## ## multiplicative_expression -> multiplicative_expression multiplicative_operator . cast_expression [ STAR SLASH SEMICOLON RPAREN RIGHT RBRACK RBRACE QUESTION PLUS PERCENT NEQ MINUS LT LEQ LEFT HAT GT GEQ EQEQ COMMA COLON BARBAR BAR ANDAND AND ] ## ## The known suffix of the stack is as follows: -## multiplicative_expression multiplicative_operator +## multiplicative_expression multiplicative_operator ## # clang and gcc expect an expression. @@ -1509,14 +1509,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME XOR_ASSIGN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME XOR_ASSIGN XOR_ASSIGN ## -## Ends in an error in state: 174. +## Ends in an error in state: 99. ## ## assignment_expression -> unary_expression assignment_operator . assignment_expression [ SEMICOLON RPAREN RBRACK RBRACE COMMA COLON ] ## ## The known suffix of the stack is as follows: -## unary_expression assignment_operator +## unary_expression assignment_operator ## # clang and gcc expect an expression. @@ -1526,14 +1526,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 232. +## Ends in an error in state: 157. ## ## argument_expression_list -> argument_expression_list COMMA . assignment_expression [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## argument_expression_list COMMA +## argument_expression_list COMMA ## # Here, we could say more about the context if we parameterized @@ -1547,23 +1547,23 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME DOT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME DOT XOR_ASSIGN ## -## Ends in an error in state: 238. +## Ends in an error in state: 163. ## ## postfix_expression -> postfix_expression DOT . general_identifier [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## postfix_expression DOT +## postfix_expression DOT ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME PTR XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME PTR XOR_ASSIGN ## -## Ends in an error in state: 159. +## Ends in an error in state: 84. ## ## postfix_expression -> postfix_expression PTR . general_identifier [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## postfix_expression PTR +## postfix_expression PTR ## # clang and gcc expect an identifier. @@ -1573,35 +1573,35 @@ At this point, the name of a struct or union member is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LBRACK PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LBRACK PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 235. +## Ends in an error in state: 160. ## ## expression -> expression . COMMA assignment_expression [ RBRACK COMMA ] ## postfix_expression -> postfix_expression LBRACK expression . RBRACK [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## postfix_expression LBRACK expression +## postfix_expression LBRACK expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## # We know for sure that an array subscript expression has begun, and @@ -1618,14 +1618,14 @@ then at this point, a closing bracket ']' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LBRACK XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LBRACK XOR_ASSIGN ## -## Ends in an error in state: 234. +## Ends in an error in state: 159. ## ## postfix_expression -> postfix_expression LBRACK . expression RBRACK [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## postfix_expression LBRACK +## postfix_expression LBRACK ## Ill-formed expression. @@ -1633,35 +1633,35 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 231. +## Ends in an error in state: 156. ## ## argument_expression_list -> argument_expression_list . COMMA assignment_expression [ RPAREN COMMA ] ## option(argument_expression_list) -> argument_expression_list . [ RPAREN ] ## ## The known suffix of the stack is as follows: -## argument_expression_list +## argument_expression_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 230, spurious reduction of production argument_expression_list -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 155, spurious reduction of production argument_expression_list -> assignment_expression ## Up to this point, a list of expressions has been recognized: @@ -1671,14 +1671,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME LPAREN XOR_ASSIGN ## -## Ends in an error in state: 161. +## Ends in an error in state: 86. ## ## postfix_expression -> postfix_expression LPAREN . option(argument_expression_list) RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## postfix_expression LPAREN +## postfix_expression LPAREN ## # gcc and clang expect an expression: this is incomplete. @@ -1689,23 +1689,23 @@ followed with a closing parenthesis ')', is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME QUESTION PRE_NAME VAR_NAME COLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME QUESTION PRE_NAME VAR_NAME COLON XOR_ASSIGN ## -## Ends in an error in state: 222. +## Ends in an error in state: 147. ## ## conditional_expression -> logical_or_expression QUESTION expression COLON . conditional_expression [ SEMICOLON RPAREN RBRACK RBRACE COMMA COLON ] ## ## The known suffix of the stack is as follows: -## logical_or_expression QUESTION expression COLON +## logical_or_expression QUESTION expression COLON ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME QUESTION XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME QUESTION XOR_ASSIGN ## -## Ends in an error in state: 200. +## Ends in an error in state: 125. ## ## conditional_expression -> logical_or_expression QUESTION . expression COLON conditional_expression [ SEMICOLON RPAREN RBRACK RBRACE COMMA COLON ] ## ## The known suffix of the stack is as follows: -## logical_or_expression QUESTION +## logical_or_expression QUESTION ## Ill-formed conditional expression. @@ -1713,35 +1713,35 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME QUESTION PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME VAR_NAME QUESTION PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 218. +## Ends in an error in state: 143. ## ## conditional_expression -> logical_or_expression QUESTION expression . COLON conditional_expression [ SEMICOLON RPAREN RBRACK RBRACE COMMA COLON ] ## expression -> expression . COMMA assignment_expression [ COMMA COLON ] ## ## The known suffix of the stack is as follows: -## logical_or_expression QUESTION expression +## logical_or_expression QUESTION expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## # gcc and clang simply expect a colon. @@ -1756,35 +1756,35 @@ then at this point, a colon ':' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: PACKED LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: PACKED LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 391. +## Ends in an error in state: 399. ## ## argument_expression_list -> argument_expression_list . COMMA assignment_expression [ RPAREN COMMA ] ## attribute_specifier -> PACKED LPAREN argument_expression_list . RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PACKED LPAREN argument_expression_list +## PACKED LPAREN argument_expression_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 230, spurious reduction of production argument_expression_list -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 155, spurious reduction of production argument_expression_list -> assignment_expression ## Ill-formed $2 attribute. @@ -1795,14 +1795,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: PACKED LPAREN XOR_ASSIGN +translation_unit_file: PACKED LPAREN XOR_ASSIGN ## ## Ends in an error in state: 19. ## ## attribute_specifier -> PACKED LPAREN . argument_expression_list RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PACKED LPAREN +## PACKED LPAREN ## # clang expects a "parameter declarator" (?). @@ -1814,14 +1814,14 @@ At this point, a list of expressions is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME TYPEDEF_NAME +translation_unit_file: INT PRE_NAME VAR_NAME EQ PRE_NAME TYPEDEF_NAME ## ## Ends in an error in state: 24. ## ## primary_expression -> PRE_NAME . VAR_NAME [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## PRE_NAME +## PRE_NAME ## Ill-formed expression. @@ -1830,14 +1830,14 @@ The following identifier is used as a variable, but has been defined as a type: # ------------------------------------------------------------------------------ -translation_unit_file: PACKED XOR_ASSIGN +translation_unit_file: PACKED XOR_ASSIGN ## ## Ends in an error in state: 18. ## ## attribute_specifier -> PACKED . LPAREN argument_expression_list RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER RBRACK PRE_NAME PLUS PACKED NORETURN MINUS LPAREN LONG LBRACK LBRACE INT INLINE INC FLOAT EXTERN EQ ENUM DOUBLE DEC CONSTANT CONST COMMA COLON CHAR BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AUTO ATTRIBUTE AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PACKED +## PACKED ## # This one seems important, since CompCert currently does not support __packed__ @@ -1850,15 +1850,15 @@ is expected. # ------------------------------------------------------------------------------ -translation_unit_file: XOR_ASSIGN +translation_unit_file: XOR_ASSIGN ## ## Ends in an error in state: 2. ## -## list(translation_item) -> list(translation_item) . translation_item [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PRAGMA PACKED NORETURN LONG INT INLINE FLOAT EXTERN EOF ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] +## list(translation_item) -> list(translation_item) . translation_item [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC_ASSERT STATIC SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PRAGMA PACKED NORETURN LONG INT INLINE FLOAT EXTERN EOF ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## translation_unit_file -> list(translation_item) . EOF [ # ] ## ## The known suffix of the stack is as follows: -## list(translation_item) +## list(translation_item) ## # We are at the toplevel. @@ -1873,9 +1873,9 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: TYPEDEF PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: TYPEDEF PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 394. +## Ends in an error in state: 402. ## ## declaration_specifiers_typedef -> TYPEDEF list(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . storage_class_specifier_no_typedef [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] @@ -1884,11 +1884,11 @@ translation_unit_file: TYPEDEF PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## TYPEDEF list(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) +## TYPEDEF list(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: PRE_NAME TYPEDEF_NAME TYPEDEF XOR_ASSIGN +translation_unit_file: PRE_NAME TYPEDEF_NAME TYPEDEF XOR_ASSIGN ## -## Ends in an error in state: 403. +## Ends in an error in state: 411. ## ## declaration_specifiers_typedef -> typedef_name list(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . storage_class_specifier_no_typedef [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] @@ -1897,11 +1897,11 @@ translation_unit_file: PRE_NAME TYPEDEF_NAME TYPEDEF XOR_ASSIGN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## typedef_name list(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) +## typedef_name list(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) ## -translation_unit_file: VOLATILE TYPEDEF PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: VOLATILE TYPEDEF PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 413. +## Ends in an error in state: 422. ## ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . storage_class_specifier_no_typedef [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] @@ -1910,11 +1910,11 @@ translation_unit_file: VOLATILE TYPEDEF PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: VOLATILE PRE_NAME TYPEDEF_NAME TYPEDEF XOR_ASSIGN +translation_unit_file: VOLATILE PRE_NAME TYPEDEF_NAME TYPEDEF XOR_ASSIGN ## -## Ends in an error in state: 419. +## Ends in an error in state: 428. ## ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . storage_class_specifier_no_typedef [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] @@ -1923,47 +1923,47 @@ translation_unit_file: VOLATILE PRE_NAME TYPEDEF_NAME TYPEDEF XOR_ASSIGN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) ## -translation_unit_file: TYPEDEF INT XOR_ASSIGN +translation_unit_file: TYPEDEF INT XOR_ASSIGN ## -## Ends in an error in state: 396. +## Ends in an error in state: 404. ## ## declaration_specifiers_typedef -> TYPEDEF list(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## TYPEDEF list(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## TYPEDEF list(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## -translation_unit_file: INT TYPEDEF XOR_ASSIGN +translation_unit_file: INT TYPEDEF XOR_ASSIGN ## -## Ends in an error in state: 407. +## Ends in an error in state: 415. ## ## declaration_specifiers_typedef -> type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) TYPEDEF list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) TYPEDEF list(declaration_specifier_no_typedef_name) +## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) TYPEDEF list(declaration_specifier_no_typedef_name) ## -translation_unit_file: VOLATILE TYPEDEF INT XOR_ASSIGN +translation_unit_file: VOLATILE TYPEDEF INT XOR_ASSIGN ## -## Ends in an error in state: 415. +## Ends in an error in state: 424. ## ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## -translation_unit_file: VOLATILE INT TYPEDEF XOR_ASSIGN +translation_unit_file: VOLATILE INT TYPEDEF XOR_ASSIGN ## -## Ends in an error in state: 423. +## Ends in an error in state: 432. ## ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) TYPEDEF list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) TYPEDEF list(declaration_specifier_no_typedef_name) +## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) TYPEDEF list(declaration_specifier_no_typedef_name) ## # We have begun a type definition (a.k.a. declaration_specifiers_typedef). @@ -1994,7 +1994,7 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: TYPEDEF XOR_ASSIGN +translation_unit_file: TYPEDEF XOR_ASSIGN ## ## Ends in an error in state: 9. ## @@ -2006,11 +2006,11 @@ translation_unit_file: TYPEDEF XOR_ASSIGN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT RESTRICT REGISTER PRE_NAME PACKED NORETURN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## TYPEDEF list(declaration_specifier_no_type) +## TYPEDEF list(declaration_specifier_no_type) ## -translation_unit_file: VOLATILE TYPEDEF XOR_ASSIGN +translation_unit_file: VOLATILE TYPEDEF XOR_ASSIGN ## -## Ends in an error in state: 411. +## Ends in an error in state: 420. ## ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) . typedef_name list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) . type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] @@ -2020,7 +2020,7 @@ translation_unit_file: VOLATILE TYPEDEF XOR_ASSIGN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT RESTRICT REGISTER PRE_NAME PACKED NORETURN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) ## # We have seen the TYPEDEF keyword, and possibly some declaration_specifiers_no_type. @@ -2042,21 +2042,21 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN VOLATILE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN VOLATILE XOR_ASSIGN ## -## Ends in an error in state: 133. +## Ends in an error in state: 230. ## ## declaration_specifiers(parameter_declaration) -> rlist(declaration_specifier_no_type) . typedef_name list(declaration_specifier_no_type) [ STAR RPAREN PRE_NAME LPAREN LBRACK COMMA ] ## declaration_specifiers(parameter_declaration) -> rlist(declaration_specifier_no_type) . type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) [ STAR RPAREN PRE_NAME LPAREN LBRACK COMMA ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 125, spurious reduction of production rlist(declaration_specifier_no_type) -> type_qualifier_noattr +## In state 222, spurious reduction of production rlist(declaration_specifier_no_type) -> type_qualifier_noattr ## # Analogous to the above, except we are in the context of a parameter declaration, @@ -2078,9 +2078,9 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 401. +## Ends in an error in state: 409. ## ## declaration_specifiers(declaration(external_declaration)) -> typedef_name list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> typedef_name list(declaration_specifier_no_type) . TYPEDEF list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] @@ -2090,11 +2090,11 @@ translation_unit_file: PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE TYPEDEF STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## typedef_name list(declaration_specifier_no_type) +## typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 417. +## Ends in an error in state: 426. ## ## declaration_specifiers(declaration(external_declaration)) -> rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) . TYPEDEF list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] @@ -2104,29 +2104,29 @@ translation_unit_file: VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE TYPEDEF STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: INT XOR_ASSIGN +translation_unit_file: INT XOR_ASSIGN ## -## Ends in an error in state: 405. +## Ends in an error in state: 413. ## ## declaration_specifiers(declaration(external_declaration)) -> type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . TYPEDEF list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## -translation_unit_file: VOLATILE INT XOR_ASSIGN +translation_unit_file: VOLATILE INT XOR_ASSIGN ## -## Ends in an error in state: 421. +## Ends in an error in state: 430. ## ## declaration_specifiers(declaration(external_declaration)) -> rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . TYPEDEF list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## # We have seen a TYPEDEF_NAME or a primitive type specifier, @@ -2178,9 +2178,9 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 112. +## Ends in an error in state: 209. ## ## declaration_specifiers(parameter_declaration) -> typedef_name list(declaration_specifier_no_type) . [ STAR RPAREN PRE_NAME LPAREN LBRACK COMMA ] ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . storage_class_specifier_no_typedef [ VOLATILE STATIC STAR RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LBRACK INLINE EXTERN CONST COMMA AUTO ATTRIBUTE ALIGNAS ] @@ -2189,11 +2189,11 @@ translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME TYPEDEF_NAME XOR_AS ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE STATIC STAR RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LBRACK INLINE EXTERN CONST COMMA AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## typedef_name list(declaration_specifier_no_type) +## typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 135. +## Ends in an error in state: 232. ## ## declaration_specifiers(parameter_declaration) -> rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) . [ STAR RPAREN PRE_NAME LPAREN LBRACK COMMA ] ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . storage_class_specifier_no_typedef [ VOLATILE STATIC STAR RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LBRACK INLINE EXTERN CONST COMMA AUTO ATTRIBUTE ALIGNAS ] @@ -2202,27 +2202,27 @@ translation_unit_file: INT PRE_NAME VAR_NAME LPAREN VOLATILE PRE_NAME TYPEDEF_NA ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE STATIC STAR RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LBRACK INLINE EXTERN CONST COMMA AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT XOR_ASSIGN ## -## Ends in an error in state: 118. +## Ends in an error in state: 215. ## ## declaration_specifiers(parameter_declaration) -> type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR RPAREN PRE_NAME LPAREN LBRACK COMMA ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC STAR SIGNED SHORT RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK INT INLINE FLOAT EXTERN ENUM DOUBLE CONST COMMA CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN VOLATILE INT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN VOLATILE INT XOR_ASSIGN ## -## Ends in an error in state: 137. +## Ends in an error in state: 234. ## ## declaration_specifiers(parameter_declaration) -> rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR RPAREN PRE_NAME LPAREN LBRACK COMMA ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC STAR SIGNED SHORT RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK INT INLINE FLOAT EXTERN ENUM DOUBLE CONST COMMA CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## # Analogous to the above situation, except this time, we are in the @@ -2263,9 +2263,9 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: VOLATILE XOR_ASSIGN +translation_unit_file: VOLATILE XOR_ASSIGN ## -## Ends in an error in state: 409. +## Ends in an error in state: 418. ## ## declaration_specifiers(declaration(external_declaration)) -> rlist(declaration_specifier_no_type) . typedef_name list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers(declaration(external_declaration)) -> rlist(declaration_specifier_no_type) . type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] @@ -2275,13 +2275,13 @@ translation_unit_file: VOLATILE XOR_ASSIGN ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) . type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) TYPEDEF list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 125, spurious reduction of production rlist(declaration_specifier_no_type) -> type_qualifier_noattr +## In state 222, spurious reduction of production rlist(declaration_specifier_no_type) -> type_qualifier_noattr ## # We have seen some specifiers or qualifiers. We have probably seen at least @@ -2308,9 +2308,9 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE VOLATILE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE VOLATILE XOR_ASSIGN ## -## Ends in an error in state: 518. +## Ends in an error in state: 528. ## ## declaration_specifiers(declaration(block_item)) -> rlist(declaration_specifier_no_type) . typedef_name list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers(declaration(block_item)) -> rlist(declaration_specifier_no_type) . type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] @@ -2320,13 +2320,13 @@ translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) . type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) TYPEDEF list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 125, spurious reduction of production rlist(declaration_specifier_no_type) -> type_qualifier_noattr +## In state 222, spurious reduction of production rlist(declaration_specifier_no_type) -> type_qualifier_noattr ## # Identical to the previous one, except we are not at the top level, # so we know this cannot be the beginning of a function definition. @@ -2339,9 +2339,9 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE PRE_NAME TYPEDEF_NAME VOLATILE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE PRE_NAME TYPEDEF_NAME VOLATILE XOR_ASSIGN ## -## Ends in an error in state: 515. +## Ends in an error in state: 524. ## ## declaration_specifiers(declaration(block_item)) -> typedef_name list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> typedef_name list(declaration_specifier_no_type) . TYPEDEF list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] @@ -2351,11 +2351,11 @@ translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE TYPEDEF STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## typedef_name list(declaration_specifier_no_type) +## typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 520. +## Ends in an error in state: 530. ## ## declaration_specifiers(declaration(block_item)) -> rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) . TYPEDEF list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] @@ -2365,29 +2365,29 @@ translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE TYPEDEF STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE INT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE INT XOR_ASSIGN ## -## Ends in an error in state: 517. +## Ends in an error in state: 526. ## ## declaration_specifiers(declaration(block_item)) -> type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . TYPEDEF list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE VOLATILE INT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE VOLATILE INT XOR_ASSIGN ## -## Ends in an error in state: 522. +## Ends in an error in state: 532. ## ## declaration_specifiers(declaration(block_item)) -> rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . TYPEDEF list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## # This is analogous to the error sentence TYPEDEF_NAME VOLATILE XOR_ASSIGN, @@ -2418,20 +2418,20 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: UNION LBRACE PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: UNION LBRACE PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 92. +## Ends in an error in state: 189. ## -## struct_declaration -> specifier_qualifier_list(struct_declaration) . option(struct_declarator_list) SEMICOLON [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT SIGNED SHORT RESTRICT RBRACE PRE_NAME PACKED LONG INT FLOAT ENUM DOUBLE CONST CHAR ATTRIBUTE ALIGNAS ] +## struct_declaration -> specifier_qualifier_list(struct_declaration) . option(struct_declarator_list) SEMICOLON [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC_ASSERT SIGNED SHORT RESTRICT RBRACE PRE_NAME PACKED LONG INT FLOAT ENUM DOUBLE CONST CHAR ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## specifier_qualifier_list(struct_declaration) +## specifier_qualifier_list(struct_declaration) ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 78, spurious reduction of production specifier_qualifier_list(struct_declaration) -> typedef_name option(type_qualifier_list) +## In state 174, spurious reduction of production specifier_qualifier_list(struct_declaration) -> typedef_name option(type_qualifier_list) ## # We have (spuriously) recognized a specifier_qualifier_list, @@ -2463,35 +2463,35 @@ at this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: UNION LBRACE LONG COLON CONSTANT RPAREN +translation_unit_file: UNION LBRACE LONG COLON CONSTANT RPAREN ## -## Ends in an error in state: 287. +## Ends in an error in state: 295. ## ## option(struct_declarator_list) -> struct_declarator_list . [ SEMICOLON ] ## struct_declarator_list -> struct_declarator_list . COMMA struct_declarator [ SEMICOLON COMMA ] ## ## The known suffix of the stack is as follows: -## struct_declarator_list +## struct_declarator_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 154, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 292, spurious reduction of production struct_declarator -> option(declarator) COLON conditional_expression -## In state 294, spurious reduction of production struct_declarator_list -> struct_declarator +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 79, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 300, spurious reduction of production struct_declarator -> option(declarator) COLON conditional_expression +## In state 302, spurious reduction of production struct_declarator_list -> struct_declarator ## # We have seen a non-empty struct_declarator_list. @@ -2507,14 +2507,14 @@ then at this point, a semicolon ';' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: UNION LBRACE INT COLON XOR_ASSIGN +translation_unit_file: UNION LBRACE INT COLON XOR_ASSIGN ## -## Ends in an error in state: 291. +## Ends in an error in state: 299. ## ## struct_declarator -> option(declarator) COLON . conditional_expression [ SEMICOLON COMMA ] ## ## The known suffix of the stack is as follows: -## option(declarator) COLON +## option(declarator) COLON ## Ill-formed struct declarator. @@ -2522,14 +2522,14 @@ At this point, a constant expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: UNION LBRACE INT PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: UNION LBRACE INT PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 288. +## Ends in an error in state: 296. ## ## struct_declarator_list -> struct_declarator_list COMMA . struct_declarator [ SEMICOLON COMMA ] ## ## The known suffix of the stack is as follows: -## struct_declarator_list COMMA +## struct_declarator_list COMMA ## Ill-formed struct declaration. @@ -2537,23 +2537,23 @@ At this point, a struct declarator is expected. # ------------------------------------------------------------------------------ -translation_unit_file: UNION LBRACE INT PRE_NAME VAR_NAME RPAREN +translation_unit_file: UNION LBRACE INT PRE_NAME VAR_NAME RPAREN ## -## Ends in an error in state: 293. +## Ends in an error in state: 301. ## ## option(declarator) -> declarator . [ COLON ] ## struct_declarator -> declarator . [ SEMICOLON COMMA ] ## ## The known suffix of the stack is as follows: -## declarator +## declarator ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 255, spurious reduction of production declarator_noattrend -> direct_declarator -## In state 260, spurious reduction of production attribute_specifier_list -> -## In state 261, spurious reduction of production declarator -> declarator_noattrend attribute_specifier_list +## In state 263, spurious reduction of production declarator_noattrend -> direct_declarator +## In state 268, spurious reduction of production attribute_specifier_list -> +## In state 269, spurious reduction of production declarator -> declarator_noattrend attribute_specifier_list ## # Assuming the declarator so far is complete, we expect @@ -2574,16 +2574,16 @@ then at this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: UNION LBRACE VOLATILE ADD_ASSIGN +translation_unit_file: UNION LBRACE VOLATILE ADD_ASSIGN ## -## Ends in an error in state: 86. +## Ends in an error in state: 182. ## ## option(type_qualifier_list) -> type_qualifier_list . [ VOLATILE RESTRICT PACKED CONST ATTRIBUTE ALIGNAS ] ## specifier_qualifier_list(struct_declaration) -> type_qualifier_list . typedef_name option(type_qualifier_list) [ STAR SEMICOLON PRE_NAME LPAREN COLON ] ## specifier_qualifier_list(struct_declaration) -> type_qualifier_list . type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN COLON ] ## ## The known suffix of the stack is as follows: -## type_qualifier_list +## type_qualifier_list ## # A list of qualifiers has been read. @@ -2597,15 +2597,15 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: UNION LBRACE XOR_ASSIGN +translation_unit_file: UNION LBRACE XOR_ASSIGN ## ## Ends in an error in state: 75. ## -## struct_declaration_list -> struct_declaration_list . struct_declaration [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT SIGNED SHORT RESTRICT RBRACE PRE_NAME PACKED LONG INT FLOAT ENUM DOUBLE CONST CHAR ATTRIBUTE ALIGNAS ] +## struct_declaration_list -> struct_declaration_list . struct_declaration [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC_ASSERT SIGNED SHORT RESTRICT RBRACE PRE_NAME PACKED LONG INT FLOAT ENUM DOUBLE CONST CHAR ATTRIBUTE ALIGNAS ] ## struct_or_union_specifier -> struct_or_union attribute_specifier_list option(other_identifier) LBRACE struct_declaration_list . RBRACE [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK INT INLINE FLOAT EXTERN ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## struct_or_union attribute_specifier_list option(other_identifier) LBRACE struct_declaration_list +## struct_or_union attribute_specifier_list option(other_identifier) LBRACE struct_declaration_list ## # gcc and clang do not seem prepared to accept a struct or union with @@ -2617,7 +2617,7 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: UNION XOR_ASSIGN +translation_unit_file: UNION XOR_ASSIGN ## ## Ends in an error in state: 72. ## @@ -2625,7 +2625,7 @@ translation_unit_file: UNION XOR_ASSIGN ## struct_or_union_specifier -> struct_or_union attribute_specifier_list . general_identifier [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF STRUCT STATIC STAR SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK INT INLINE FLOAT EXTERN ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## struct_or_union attribute_specifier_list +## struct_or_union attribute_specifier_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an @@ -2646,22 +2646,22 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 264. +## Ends in an error in state: 272. ## ## direct_declarator -> LPAREN save_context declarator . RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## LPAREN save_context declarator +## LPAREN save_context declarator ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 255, spurious reduction of production declarator_noattrend -> direct_declarator -## In state 260, spurious reduction of production attribute_specifier_list -> -## In state 261, spurious reduction of production declarator -> declarator_noattrend attribute_specifier_list +## In state 263, spurious reduction of production declarator_noattrend -> direct_declarator +## In state 268, spurious reduction of production attribute_specifier_list -> +## In state 269, spurious reduction of production declarator -> declarator_noattrend attribute_specifier_list ## Up to this point, a declarator has been recognized: @@ -2671,14 +2671,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT LPAREN XOR_ASSIGN +translation_unit_file: INT LPAREN XOR_ASSIGN ## -## Ends in an error in state: 98. +## Ends in an error in state: 195. ## ## direct_declarator -> LPAREN save_context . declarator RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## LPAREN save_context +## LPAREN save_context ## # clang and gcc expect identifier or '(', as usual. @@ -2688,15 +2688,15 @@ At this point, a declarator is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME XOR_ASSIGN ## -## Ends in an error in state: 281. +## Ends in an error in state: 289. ## ## identifier_list -> identifier_list . COMMA PRE_NAME VAR_NAME [ RPAREN COMMA ] ## option(identifier_list) -> identifier_list . [ RPAREN ] ## ## The known suffix of the stack is as follows: -## identifier_list +## identifier_list ## Ill-formed K&R function definition. @@ -2707,15 +2707,15 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN XOR_ASSIGN ## -## Ends in an error in state: 104. +## Ends in an error in state: 201. ## ## context_parameter_type_list -> save_context . parameter_type_list save_context [ RPAREN ] ## direct_declarator -> direct_declarator LPAREN save_context . option(identifier_list) RPAREN [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## direct_declarator LPAREN save_context +## direct_declarator LPAREN save_context ## # Ignore K&R syntax, just request ANSI syntax. @@ -2731,9 +2731,9 @@ followed with a closing parenthesis ')', is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT STAR RPAREN +translation_unit_file: INT STAR RPAREN ## -## Ends in an error in state: 101. +## Ends in an error in state: 198. ## ## declarator_noattrend -> list(pointer1) STAR option(type_qualifier_list) . direct_declarator [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LONG LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## list(pointer1) -> list(pointer1) STAR option(type_qualifier_list) . [ STAR ] @@ -2741,7 +2741,7 @@ translation_unit_file: INT STAR RPAREN ## type_qualifier_list -> option(type_qualifier_list) . attribute_specifier [ VOLATILE STAR RESTRICT PRE_NAME PACKED LPAREN CONST ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## list(pointer1) STAR option(type_qualifier_list) +## list(pointer1) STAR option(type_qualifier_list) ## # If the pointer isn't finished, we expect @@ -2764,26 +2764,26 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: TYPEDEF INT PRE_NAME VAR_NAME XOR_ASSIGN +translation_unit_file: TYPEDEF INT PRE_NAME VAR_NAME XOR_ASSIGN ## -## Ends in an error in state: 534. +## Ends in an error in state: 544. ## ## option(typedef_declarator_list) -> typedef_declarator_list . [ SEMICOLON ] ## typedef_declarator_list -> typedef_declarator_list . COMMA typedef_declarator [ SEMICOLON COMMA ] ## ## The known suffix of the stack is as follows: -## typedef_declarator_list +## typedef_declarator_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 255, spurious reduction of production declarator_noattrend -> direct_declarator -## In state 260, spurious reduction of production attribute_specifier_list -> -## In state 261, spurious reduction of production declarator -> declarator_noattrend attribute_specifier_list -## In state 538, spurious reduction of production declare_typename(declarator) -> declarator -## In state 537, spurious reduction of production typedef_declarator -> declare_typename(declarator) -## In state 539, spurious reduction of production typedef_declarator_list -> typedef_declarator +## In state 263, spurious reduction of production declarator_noattrend -> direct_declarator +## In state 268, spurious reduction of production attribute_specifier_list -> +## In state 269, spurious reduction of production declarator -> declarator_noattrend attribute_specifier_list +## In state 548, spurious reduction of production declare_typename(declarator) -> declarator +## In state 547, spurious reduction of production typedef_declarator -> declare_typename(declarator) +## In state 549, spurious reduction of production typedef_declarator_list -> typedef_declarator ## # Because attribute_specifier_list, declarator and declarator_noattrend have been marked @@ -2807,28 +2807,28 @@ then at this point, a semicolon ';' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: TYPEDEF INT PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: TYPEDEF INT PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 535. +## Ends in an error in state: 545. ## ## typedef_declarator_list -> typedef_declarator_list COMMA . typedef_declarator [ SEMICOLON COMMA ] ## ## The known suffix of the stack is as follows: -## typedef_declarator_list COMMA +## typedef_declarator_list COMMA ## At this point, a declarator is expected. # ------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN INT LPAREN RPAREN LPAREN XOR_ASSIGN +translation_unit_file: ALIGNAS LPAREN INT LPAREN RPAREN LPAREN XOR_ASSIGN ## -## Ends in an error in state: 249. +## Ends in an error in state: 257. ## ## direct_abstract_declarator -> direct_abstract_declarator LPAREN . option(context_parameter_type_list) RPAREN [ RPAREN LPAREN LBRACK COMMA ] ## ## The known suffix of the stack is as follows: -## direct_abstract_declarator LPAREN +## direct_abstract_declarator LPAREN ## At this point, a list of parameter declarations, @@ -2836,32 +2836,32 @@ followed with a closing parenthesis ')', is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM CONST XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM CONST XOR_ASSIGN ## -## Ends in an error in state: 450. +## Ends in an error in state: 459. ## ## asm_attributes -> CONST . asm_attributes [ LPAREN ] ## ## The known suffix of the stack is as follows: -## CONST +## CONST ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM VOLATILE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM VOLATILE XOR_ASSIGN ## -## Ends in an error in state: 449. +## Ends in an error in state: 458. ## ## asm_attributes -> VOLATILE . asm_attributes [ LPAREN ] ## ## The known suffix of the stack is as follows: -## VOLATILE +## VOLATILE ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM XOR_ASSIGN ## -## Ends in an error in state: 448. +## Ends in an error in state: 457. ## -## asm_statement -> ASM . asm_attributes LPAREN string_literals_list asm_arguments RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## asm_statement -> ASM . asm_attributes LPAREN string_literals_list asm_arguments RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ASM +## ASM ## Ill-formed assembly statement. @@ -2871,26 +2871,26 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON COLON COLON STRING_LITERAL COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON COLON COLON STRING_LITERAL COMMA XOR_ASSIGN ## -## Ends in an error in state: 474. +## Ends in an error in state: 483. ## ## asm_flags -> asm_flags COMMA . string_literals_list [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## asm_flags COMMA +## asm_flags COMMA ## # We are in the clobber list. # We have seen a comma, so we expect a string literal. # first(asm_flags) = STRING_LITERAL -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON COLON COLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON COLON COLON XOR_ASSIGN ## -## Ends in an error in state: 471. +## Ends in an error in state: 480. ## ## asm_arguments -> COLON asm_operands COLON asm_operands COLON . asm_flags [ RPAREN ] ## ## The known suffix of the stack is as follows: -## COLON asm_operands COLON asm_operands COLON +## COLON asm_operands COLON asm_operands COLON ## # We are at the beginning of the clobber list. # first(asm_flags) = STRING_LITERAL @@ -2903,21 +2903,21 @@ Examples of clobbered resources: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON COLON COLON STRING_LITERAL XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON COLON COLON STRING_LITERAL XOR_ASSIGN ## -## Ends in an error in state: 473. +## Ends in an error in state: 482. ## ## asm_arguments -> COLON asm_operands COLON asm_operands COLON asm_flags . [ RPAREN ] ## asm_flags -> asm_flags . COMMA string_literals_list [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## COLON asm_operands COLON asm_operands COLON asm_flags +## COLON asm_operands COLON asm_operands COLON asm_flags ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 472, spurious reduction of production asm_flags -> string_literals_list +## In state 481, spurious reduction of production asm_flags -> string_literals_list ## # Let's ignore the possibility of concatenating string literals. @@ -2932,22 +2932,22 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL LPAREN CONSTANT RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL LPAREN CONSTANT RPAREN XOR_ASSIGN ## -## Ends in an error in state: 468. +## Ends in an error in state: 477. ## ## asm_arguments -> COLON asm_operands . [ RPAREN ] ## asm_arguments -> COLON asm_operands . COLON asm_operands [ RPAREN ] ## asm_arguments -> COLON asm_operands . COLON asm_operands COLON asm_flags [ RPAREN ] ## ## The known suffix of the stack is as follows: -## COLON asm_operands +## COLON asm_operands ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 460, spurious reduction of production asm_operands -> asm_operands_ne +## In state 469, spurious reduction of production asm_operands -> asm_operands_ne ## # We have seen one COLON, hence the outputs. (The list of outputs may be empty.) @@ -2962,21 +2962,21 @@ then at this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON COLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON COLON XOR_ASSIGN ## -## Ends in an error in state: 470. +## Ends in an error in state: 479. ## ## asm_arguments -> COLON asm_operands COLON asm_operands . [ RPAREN ] ## asm_arguments -> COLON asm_operands COLON asm_operands . COLON asm_flags [ RPAREN ] ## ## The known suffix of the stack is as follows: -## COLON asm_operands COLON asm_operands +## COLON asm_operands COLON asm_operands ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 469, spurious reduction of production asm_operands -> +## In state 478, spurious reduction of production asm_operands -> ## # We have seen two COLONs, hence the outputs and inputs. (The list of inputs may be empty.) @@ -2994,14 +2994,14 @@ then at this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON LBRACK PRE_NAME VAR_NAME RBRACK XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON LBRACK PRE_NAME VAR_NAME RBRACK XOR_ASSIGN ## -## Ends in an error in state: 463. +## Ends in an error in state: 472. ## ## asm_operand -> asm_op_name . string_literals_list LPAREN expression RPAREN [ RPAREN COMMA COLON ] ## ## The known suffix of the stack is as follows: -## asm_op_name +## asm_op_name ## # Example of asm_operand: [oldval]"=r"(res) @@ -3013,14 +3013,14 @@ At this point, a string literal, representing a constraint, is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON LBRACK PRE_NAME VAR_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON LBRACK PRE_NAME VAR_NAME XOR_ASSIGN ## -## Ends in an error in state: 458. +## Ends in an error in state: 467. ## ## asm_op_name -> LBRACK general_identifier . RBRACK [ STRING_LITERAL ] ## ## The known suffix of the stack is as follows: -## LBRACK general_identifier +## LBRACK general_identifier ## Ill-formed assembly operand. @@ -3028,14 +3028,14 @@ At this point, a closing bracket ']' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON LBRACK XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON LBRACK XOR_ASSIGN ## -## Ends in an error in state: 457. +## Ends in an error in state: 466. ## ## asm_op_name -> LBRACK . general_identifier RBRACK [ STRING_LITERAL ] ## ## The known suffix of the stack is as follows: -## LBRACK +## LBRACK ## Ill-formed assembly operand. @@ -3043,14 +3043,14 @@ At this point, an identifier is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL LPAREN CONSTANT RPAREN COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL LPAREN CONSTANT RPAREN COMMA XOR_ASSIGN ## -## Ends in an error in state: 461. +## Ends in an error in state: 470. ## ## asm_operands_ne -> asm_operands_ne COMMA . asm_operand [ RPAREN COMMA COLON ] ## ## The known suffix of the stack is as follows: -## asm_operands_ne COMMA +## asm_operands_ne COMMA ## # clang and gcc request a string literal (which is incomplete). @@ -3060,35 +3060,35 @@ At this point, an assembly operand is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 466. +## Ends in an error in state: 475. ## ## asm_operand -> asm_op_name string_literals_list LPAREN expression . RPAREN [ RPAREN COMMA COLON ] ## expression -> expression . COMMA assignment_expression [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## asm_op_name string_literals_list LPAREN expression +## asm_op_name string_literals_list LPAREN expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## Ill-formed assembly operand. @@ -3099,14 +3099,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL LPAREN XOR_ASSIGN ## -## Ends in an error in state: 465. +## Ends in an error in state: 474. ## ## asm_operand -> asm_op_name string_literals_list LPAREN . expression RPAREN [ RPAREN COMMA COLON ] ## ## The known suffix of the stack is as follows: -## asm_op_name string_literals_list LPAREN +## asm_op_name string_literals_list LPAREN ## Ill-formed assembly operand. @@ -3114,15 +3114,15 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL COLON STRING_LITERAL XOR_ASSIGN ## -## Ends in an error in state: 464. +## Ends in an error in state: 473. ## ## asm_operand -> asm_op_name string_literals_list . LPAREN expression RPAREN [ RPAREN COMMA COLON ] ## string_literals_list -> string_literals_list . STRING_LITERAL [ STRING_LITERAL LPAREN ] ## ## The known suffix of the stack is as follows: -## asm_op_name string_literals_list +## asm_op_name string_literals_list ## # If we disregard the concatenation of string literals, then @@ -3134,15 +3134,15 @@ followed with an expression and a closing parenthesis ')', is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL XOR_ASSIGN ## -## Ends in an error in state: 455. +## Ends in an error in state: 464. ## -## asm_statement -> ASM asm_attributes LPAREN string_literals_list . asm_arguments RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## asm_statement -> ASM asm_attributes LPAREN string_literals_list . asm_arguments RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## string_literals_list -> string_literals_list . STRING_LITERAL [ STRING_LITERAL RPAREN COLON ] ## ## The known suffix of the stack is as follows: -## ASM asm_attributes LPAREN string_literals_list +## ASM asm_attributes LPAREN string_literals_list ## # Expecting either one more string literal, or COLON, or RPAREN. @@ -3156,14 +3156,14 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN XOR_ASSIGN ## -## Ends in an error in state: 454. +## Ends in an error in state: 463. ## -## asm_statement -> ASM asm_attributes LPAREN . string_literals_list asm_arguments RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## asm_statement -> ASM asm_attributes LPAREN . string_literals_list asm_arguments RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ASM asm_attributes LPAREN +## ASM asm_attributes LPAREN ## Ill-formed assembly statement. @@ -3171,50 +3171,50 @@ At this point, a string literal, representing an instruction, is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE BREAK XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE BREAK XOR_ASSIGN ## -## Ends in an error in state: 446. +## Ends in an error in state: 455. ## -## jump_statement -> BREAK . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## jump_statement -> BREAK . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## BREAK +## BREAK ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE CONTINUE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE CONTINUE XOR_ASSIGN ## -## Ends in an error in state: 441. +## Ends in an error in state: 450. ## -## jump_statement -> CONTINUE . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## jump_statement -> CONTINUE . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## CONTINUE +## CONTINUE ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON WHILE LPAREN PRE_NAME VAR_NAME RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON WHILE LPAREN PRE_NAME VAR_NAME RPAREN XOR_ASSIGN ## -## Ends in an error in state: 565. +## Ends in an error in state: 575. ## -## iteration_statement -> save_context do_statement1 WHILE LPAREN expression RPAREN . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context do_statement1 WHILE LPAREN expression RPAREN . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context do_statement1 WHILE LPAREN expression RPAREN +## save_context do_statement1 WHILE LPAREN expression RPAREN ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE GOTO PRE_NAME VAR_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE GOTO PRE_NAME VAR_NAME XOR_ASSIGN ## -## Ends in an error in state: 437. +## Ends in an error in state: 446. ## -## jump_statement -> GOTO general_identifier . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## jump_statement -> GOTO general_identifier . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## GOTO general_identifier +## GOTO general_identifier ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE ASM LPAREN STRING_LITERAL RPAREN XOR_ASSIGN ## -## Ends in an error in state: 478. +## Ends in an error in state: 487. ## -## asm_statement -> ASM asm_attributes LPAREN string_literals_list asm_arguments RPAREN . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## asm_statement -> ASM asm_attributes LPAREN string_literals_list asm_arguments RPAREN . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## ASM asm_attributes LPAREN string_literals_list asm_arguments RPAREN +## ASM asm_attributes LPAREN string_literals_list asm_arguments RPAREN ## Ill-formed statement. @@ -3222,32 +3222,32 @@ At this point, a semicolon ';' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE CASE CONSTANT COLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE CASE CONSTANT COLON XOR_ASSIGN ## -## Ends in an error in state: 445. +## Ends in an error in state: 454. ## -## labeled_statement -> CASE conditional_expression COLON . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## labeled_statement -> CASE conditional_expression COLON . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## CASE conditional_expression COLON +## CASE conditional_expression COLON ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DEFAULT COLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DEFAULT COLON XOR_ASSIGN ## -## Ends in an error in state: 440. +## Ends in an error in state: 449. ## -## labeled_statement -> DEFAULT COLON . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## labeled_statement -> DEFAULT COLON . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## DEFAULT COLON +## DEFAULT COLON ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE PRE_NAME VAR_NAME COLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE PRE_NAME VAR_NAME COLON XOR_ASSIGN ## -## Ends in an error in state: 494. +## Ends in an error in state: 503. ## -## labeled_statement -> general_identifier COLON . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## labeled_statement -> general_identifier COLON . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## general_identifier COLON +## general_identifier COLON ## # gcc and clang request an expression, which seems misleading (incomplete). @@ -3257,32 +3257,32 @@ At this point, a statement is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE CASE CONSTANT SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE CASE CONSTANT SEMICOLON ## -## Ends in an error in state: 444. +## Ends in an error in state: 453. ## -## labeled_statement -> CASE conditional_expression . COLON statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## labeled_statement -> CASE conditional_expression . COLON statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## CASE conditional_expression +## CASE conditional_expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 154, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 79, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression ## Ill-formed labeled statement. @@ -3293,14 +3293,14 @@ then at this point, a colon ':' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE CASE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE CASE XOR_ASSIGN ## -## Ends in an error in state: 443. +## Ends in an error in state: 452. ## -## labeled_statement -> CASE . conditional_expression COLON statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## labeled_statement -> CASE . conditional_expression COLON statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## CASE +## CASE ## Ill-formed labeled statement. @@ -3308,23 +3308,23 @@ At this point, a constant expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DEFAULT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DEFAULT XOR_ASSIGN ## -## Ends in an error in state: 439. +## Ends in an error in state: 448. ## -## labeled_statement -> DEFAULT . COLON statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## labeled_statement -> DEFAULT . COLON statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## DEFAULT +## DEFAULT ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 493. +## Ends in an error in state: 502. ## -## labeled_statement -> general_identifier . COLON statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## labeled_statement -> general_identifier . COLON statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## general_identifier +## general_identifier ## # gcc and clang apparently do not allow a TYPEDEF_NAME to be reclassified as a label. @@ -3334,35 +3334,35 @@ At this point, a colon ':' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON WHILE LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON WHILE LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 564. +## Ends in an error in state: 574. ## ## expression -> expression . COMMA assignment_expression [ RPAREN COMMA ] -## iteration_statement -> save_context do_statement1 WHILE LPAREN expression . RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context do_statement1 WHILE LPAREN expression . RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context do_statement1 WHILE LPAREN expression +## save_context do_statement1 WHILE LPAREN expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## Ill-formed 'do' ... 'while' statement. @@ -3373,14 +3373,14 @@ then at this point, a closing parenthesis ')' and a semicolon ';' are expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON WHILE LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON WHILE LPAREN XOR_ASSIGN ## -## Ends in an error in state: 563. +## Ends in an error in state: 573. ## -## iteration_statement -> save_context do_statement1 WHILE LPAREN . expression RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context do_statement1 WHILE LPAREN . expression RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context do_statement1 WHILE LPAREN +## save_context do_statement1 WHILE LPAREN ## Ill-formed 'do' ... 'while' statement. @@ -3388,14 +3388,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON WHILE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON WHILE XOR_ASSIGN ## -## Ends in an error in state: 562. +## Ends in an error in state: 572. ## -## iteration_statement -> save_context do_statement1 WHILE . LPAREN expression RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context do_statement1 WHILE . LPAREN expression RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context do_statement1 WHILE +## save_context do_statement1 WHILE ## Ill-formed 'do' ... 'while' statement. @@ -3403,14 +3403,14 @@ At this point, an opening parenthesis '(' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO SEMICOLON XOR_ASSIGN ## -## Ends in an error in state: 561. +## Ends in an error in state: 571. ## -## iteration_statement -> save_context do_statement1 . WHILE LPAREN expression RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context do_statement1 . WHILE LPAREN expression RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context do_statement1 +## save_context do_statement1 ## # Quite nicely, in this case, there is no doubt that the statement is @@ -3424,14 +3424,14 @@ At this point, a 'while' keyword is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO XOR_ASSIGN ## -## Ends in an error in state: 557. +## Ends in an error in state: 567. ## ## do_statement1 -> save_context DO . statement [ WHILE ] ## ## The known suffix of the stack is as follows: -## save_context DO +## save_context DO ## # gcc and clang expect an expression. @@ -3441,14 +3441,14 @@ At this point, a statement (the loop body) is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN SEMICOLON SEMICOLON RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN SEMICOLON SEMICOLON RPAREN XOR_ASSIGN ## -## Ends in an error in state: 527. +## Ends in an error in state: 537. ## -## iteration_statement -> save_context FOR LPAREN for_statement_header optional(expression,SEMICOLON) optional(expression,RPAREN) . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context FOR LPAREN for_statement_header optional(expression,SEMICOLON) optional(expression,RPAREN) . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context FOR LPAREN for_statement_header optional(expression,SEMICOLON) optional(expression,RPAREN) +## save_context FOR LPAREN for_statement_header optional(expression,SEMICOLON) optional(expression,RPAREN) ## Ill-formed 'for' statement. @@ -3456,35 +3456,35 @@ At this point, a statement (the loop body) is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN SEMICOLON SEMICOLON PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN SEMICOLON SEMICOLON PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 529. +## Ends in an error in state: 539. ## ## expression -> expression . COMMA assignment_expression [ RPAREN COMMA ] ## optional(expression,RPAREN) -> expression . RPAREN [ WHILE TILDE SWITCH STRING_LITERAL STAR SIZEOF SEMICOLON RETURN PRE_NAME PLUS MINUS LPAREN LBRACE INC IF GOTO FOR DO DEFAULT DEC CONTINUE CONSTANT CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG ASM AND ALIGNOF ] ## ## The known suffix of the stack is as follows: -## expression +## expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## # The use of optional(expression,RPAREN) tells us that we are in a FOR statement. @@ -3498,14 +3498,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN SEMICOLON SEMICOLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN SEMICOLON SEMICOLON XOR_ASSIGN ## -## Ends in an error in state: 525. +## Ends in an error in state: 535. ## -## iteration_statement -> save_context FOR LPAREN for_statement_header optional(expression,SEMICOLON) . optional(expression,RPAREN) statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context FOR LPAREN for_statement_header optional(expression,SEMICOLON) . optional(expression,RPAREN) statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context FOR LPAREN for_statement_header optional(expression,SEMICOLON) +## save_context FOR LPAREN for_statement_header optional(expression,SEMICOLON) ## # Expecting the third part of the loop header -- the expression @@ -3518,14 +3518,14 @@ followed with a closing parenthesis ')', is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN SEMICOLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN SEMICOLON XOR_ASSIGN ## -## Ends in an error in state: 524. +## Ends in an error in state: 534. ## -## iteration_statement -> save_context FOR LPAREN for_statement_header . optional(expression,SEMICOLON) optional(expression,RPAREN) statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context FOR LPAREN for_statement_header . optional(expression,SEMICOLON) optional(expression,RPAREN) statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context FOR LPAREN for_statement_header +## save_context FOR LPAREN for_statement_header ## # Expecting the second part of the loop header -- the controlling expression. @@ -3537,35 +3537,35 @@ followed with a semicolon ';', is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN PRE_NAME VAR_NAME RPAREN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN PRE_NAME VAR_NAME RPAREN ## -## Ends in an error in state: 531. +## Ends in an error in state: 541. ## ## expression -> expression . COMMA assignment_expression [ SEMICOLON COMMA ] ## optional(expression,SEMICOLON) -> expression . SEMICOLON [ TILDE STRING_LITERAL STAR SIZEOF SEMICOLON RPAREN PRE_NAME PLUS MINUS LPAREN INC DEC CONSTANT BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AND ALIGNOF ] ## ## The known suffix of the stack is as follows: -## expression +## expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## # At the time of writing, optional(expression,SEMICOLON) is used only in FOR @@ -3579,14 +3579,14 @@ then at this point, a semicolon ';' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR LPAREN XOR_ASSIGN ## -## Ends in an error in state: 512. +## Ends in an error in state: 521. ## -## iteration_statement -> save_context FOR LPAREN . for_statement_header optional(expression,SEMICOLON) optional(expression,RPAREN) statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context FOR LPAREN . for_statement_header optional(expression,SEMICOLON) optional(expression,RPAREN) statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context FOR LPAREN +## save_context FOR LPAREN ## # gcc and clang say they expect an expression, which is incomplete. @@ -3600,14 +3600,14 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE FOR XOR_ASSIGN ## -## Ends in an error in state: 511. +## Ends in an error in state: 520. ## -## iteration_statement -> save_context FOR . LPAREN for_statement_header optional(expression,SEMICOLON) optional(expression,RPAREN) statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context FOR . LPAREN for_statement_header optional(expression,SEMICOLON) optional(expression,RPAREN) statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context FOR +## save_context FOR ## Ill-formed 'for' statement. @@ -3615,14 +3615,14 @@ At this point, an opening parenthesis '(' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE GOTO XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE GOTO XOR_ASSIGN ## -## Ends in an error in state: 436. +## Ends in an error in state: 445. ## -## jump_statement -> GOTO . general_identifier SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## jump_statement -> GOTO . general_identifier SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## GOTO +## GOTO ## Ill-formed 'goto' statement. @@ -3630,14 +3630,14 @@ At this point, an identifier (a 'goto' label) is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO IF LPAREN CONSTANT RPAREN SEMICOLON ELSE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE DO IF LPAREN CONSTANT RPAREN SEMICOLON ELSE XOR_ASSIGN ## -## Ends in an error in state: 559. +## Ends in an error in state: 569. ## -## selection_statement -> save_context ifelse_statement1 . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context ifelse_statement1 . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context ifelse_statement1 +## save_context ifelse_statement1 ## Ill-formed 'if' ... 'else' statement. @@ -3645,15 +3645,15 @@ At this point, a statement is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE IF LPAREN PRE_NAME VAR_NAME RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE IF LPAREN PRE_NAME VAR_NAME RPAREN XOR_ASSIGN ## -## Ends in an error in state: 508. +## Ends in an error in state: 517. ## ## ifelse_statement1 -> IF LPAREN expression RPAREN save_context . statement ELSE [ WHILE TILDE SWITCH STRING_LITERAL STAR SIZEOF SEMICOLON RETURN PRE_NAME PLUS MINUS LPAREN LBRACE INC IF GOTO FOR DO DEFAULT DEC CONTINUE CONSTANT CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG ASM AND ALIGNOF ] -## selection_statement -> save_context IF LPAREN expression RPAREN save_context . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context IF LPAREN expression RPAREN save_context . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context IF LPAREN expression RPAREN save_context +## save_context IF LPAREN expression RPAREN save_context ## Ill-formed 'if' statement. @@ -3661,36 +3661,36 @@ At this point, a statement is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE IF LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE IF LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 506. +## Ends in an error in state: 515. ## ## expression -> expression . COMMA assignment_expression [ RPAREN COMMA ] ## ifelse_statement1 -> IF LPAREN expression . RPAREN save_context statement ELSE [ WHILE TILDE SWITCH STRING_LITERAL STAR SIZEOF SEMICOLON RETURN PRE_NAME PLUS MINUS LPAREN LBRACE INC IF GOTO FOR DO DEFAULT DEC CONTINUE CONSTANT CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG ASM AND ALIGNOF ] -## selection_statement -> save_context IF LPAREN expression . RPAREN save_context statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context IF LPAREN expression . RPAREN save_context statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context IF LPAREN expression +## save_context IF LPAREN expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## Ill-formed 'if' statement. @@ -3701,15 +3701,15 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE IF LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE IF LPAREN XOR_ASSIGN ## -## Ends in an error in state: 505. +## Ends in an error in state: 514. ## ## ifelse_statement1 -> IF LPAREN . expression RPAREN save_context statement ELSE [ WHILE TILDE SWITCH STRING_LITERAL STAR SIZEOF SEMICOLON RETURN PRE_NAME PLUS MINUS LPAREN LBRACE INC IF GOTO FOR DO DEFAULT DEC CONTINUE CONSTANT CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG ASM AND ALIGNOF ] -## selection_statement -> save_context IF LPAREN . expression RPAREN save_context statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context IF LPAREN . expression RPAREN save_context statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context IF LPAREN +## save_context IF LPAREN ## Ill-formed 'if' statement. @@ -3717,15 +3717,15 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE IF XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE IF XOR_ASSIGN ## -## Ends in an error in state: 504. +## Ends in an error in state: 513. ## ## ifelse_statement1 -> IF . LPAREN expression RPAREN save_context statement ELSE [ WHILE TILDE SWITCH STRING_LITERAL STAR SIZEOF SEMICOLON RETURN PRE_NAME PLUS MINUS LPAREN LBRACE INC IF GOTO FOR DO DEFAULT DEC CONTINUE CONSTANT CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG ASM AND ALIGNOF ] -## selection_statement -> save_context IF . LPAREN expression RPAREN save_context statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context IF . LPAREN expression RPAREN save_context statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context IF +## save_context IF ## Ill-formed 'if' statement. @@ -3733,14 +3733,14 @@ At this point, an opening parenthesis '(' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE SWITCH LPAREN PRE_NAME VAR_NAME RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE SWITCH LPAREN PRE_NAME VAR_NAME RPAREN XOR_ASSIGN ## -## Ends in an error in state: 502. +## Ends in an error in state: 511. ## -## selection_statement -> save_context SWITCH LPAREN expression RPAREN . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context SWITCH LPAREN expression RPAREN . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context SWITCH LPAREN expression RPAREN +## save_context SWITCH LPAREN expression RPAREN ## @@ -3757,35 +3757,35 @@ enclosed within braces '{' and '}'. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE SWITCH LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE SWITCH LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 501. +## Ends in an error in state: 510. ## ## expression -> expression . COMMA assignment_expression [ RPAREN COMMA ] -## selection_statement -> save_context SWITCH LPAREN expression . RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context SWITCH LPAREN expression . RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context SWITCH LPAREN expression +## save_context SWITCH LPAREN expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## Ill-formed 'switch' statement. @@ -3796,14 +3796,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE SWITCH LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE SWITCH LPAREN XOR_ASSIGN ## -## Ends in an error in state: 500. +## Ends in an error in state: 509. ## -## selection_statement -> save_context SWITCH LPAREN . expression RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context SWITCH LPAREN . expression RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context SWITCH LPAREN +## save_context SWITCH LPAREN ## Ill-formed 'switch' statement. @@ -3811,14 +3811,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE SWITCH XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE SWITCH XOR_ASSIGN ## -## Ends in an error in state: 499. +## Ends in an error in state: 508. ## -## selection_statement -> save_context SWITCH . LPAREN expression RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## selection_statement -> save_context SWITCH . LPAREN expression RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context SWITCH +## save_context SWITCH ## Ill-formed 'switch' statement. @@ -3826,14 +3826,14 @@ At this point, an opening parenthesis '(' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE WHILE LPAREN PRE_NAME VAR_NAME RPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE WHILE LPAREN PRE_NAME VAR_NAME RPAREN XOR_ASSIGN ## -## Ends in an error in state: 486. +## Ends in an error in state: 495. ## -## iteration_statement -> save_context WHILE LPAREN expression RPAREN . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context WHILE LPAREN expression RPAREN . statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context WHILE LPAREN expression RPAREN +## save_context WHILE LPAREN expression RPAREN ## Ill-formed 'while' statement. @@ -3841,35 +3841,35 @@ At this point, a statement (the loop body) is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE WHILE LPAREN PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE WHILE LPAREN PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 485. +## Ends in an error in state: 494. ## ## expression -> expression . COMMA assignment_expression [ RPAREN COMMA ] -## iteration_statement -> save_context WHILE LPAREN expression . RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context WHILE LPAREN expression . RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context WHILE LPAREN expression +## save_context WHILE LPAREN expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## Ill-formed 'while' statement. @@ -3880,14 +3880,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE WHILE LPAREN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE WHILE LPAREN XOR_ASSIGN ## -## Ends in an error in state: 484. +## Ends in an error in state: 493. ## -## iteration_statement -> save_context WHILE LPAREN . expression RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context WHILE LPAREN . expression RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context WHILE LPAREN +## save_context WHILE LPAREN ## Ill-formed 'while' statement. @@ -3895,14 +3895,14 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE WHILE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE WHILE XOR_ASSIGN ## -## Ends in an error in state: 483. +## Ends in an error in state: 492. ## -## iteration_statement -> save_context WHILE . LPAREN expression RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## iteration_statement -> save_context WHILE . LPAREN expression RPAREN statement [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context WHILE +## save_context WHILE ## Ill-formed 'while' statement. @@ -3910,15 +3910,15 @@ At this point, an opening parenthesis '(' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE XOR_ASSIGN ## -## Ends in an error in state: 427. +## Ends in an error in state: 436. ## -## block_item_list -> option(block_item_list) . block_item [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] -## compound_statement -> save_context LBRACE option(block_item_list) . RBRACE [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## block_item_list -> option(block_item_list) . block_item [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## compound_statement -> save_context LBRACE option(block_item_list) . RBRACE [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## save_context LBRACE option(block_item_list) +## save_context LBRACE option(block_item_list) ## # We are possibly at the end of a block. # @@ -3938,14 +3938,14 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE RETURN XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE RETURN XOR_ASSIGN ## -## Ends in an error in state: 428. +## Ends in an error in state: 437. ## -## jump_statement -> RETURN . option(expression) SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## jump_statement -> RETURN . option(expression) SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN ENUM ELSE DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## RETURN +## RETURN ## # clang and gcc expect an expression. @@ -3957,37 +3957,37 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE STRING_LITERAL RPAREN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE STRING_LITERAL RPAREN ## -## Ends in an error in state: 431. +## Ends in an error in state: 440. ## ## expression -> expression . COMMA assignment_expression [ SEMICOLON COMMA ] ## option(expression) -> expression . [ SEMICOLON ] ## ## The known suffix of the stack is as follows: -## expression +## expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 155, spurious reduction of production primary_expression -> string_literals_list -## In state 157, spurious reduction of production postfix_expression -> primary_expression -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 224, spurious reduction of production expression -> assignment_expression +## In state 80, spurious reduction of production primary_expression -> string_literals_list +## In state 82, spurious reduction of production postfix_expression -> primary_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 149, spurious reduction of production expression -> assignment_expression ## Up to this point, an expression has been recognized: @@ -3997,16 +3997,16 @@ then at this point, a semicolon ';' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 568. +## Ends in an error in state: 578. ## ## declaration_specifiers(declaration(block_item)) -> typedef_name . list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers_typedef -> typedef_name . list(declaration_specifier_no_type) TYPEDEF list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] ## general_identifier -> typedef_name . [ COLON ] ## ## The known suffix of the stack is as follows: -## typedef_name +## typedef_name ## # We see a type name "foo" at the beginning of a block_item, it seems. @@ -4032,14 +4032,14 @@ at this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME RPAREN LBRACE PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 219. +## Ends in an error in state: 144. ## ## expression -> expression COMMA . assignment_expression [ SEMICOLON RPAREN RBRACK COMMA COLON ] ## ## The known suffix of the stack is as follows: -## expression COMMA +## expression COMMA ## Ill-formed use of the sequencing operator ','. @@ -4047,26 +4047,26 @@ At this point, an expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME COMMA PRE_NAME VAR_NAME RPAREN +translation_unit_file: INT PRE_NAME VAR_NAME COMMA PRE_NAME VAR_NAME RPAREN ## -## Ends in an error in state: 545. +## Ends in an error in state: 555. ## ## init_declarator_list -> init_declarator_list . COMMA init_declarator [ SEMICOLON COMMA ] ## option(init_declarator_list) -> init_declarator_list . [ SEMICOLON ] ## ## The known suffix of the stack is as follows: -## init_declarator_list +## init_declarator_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 255, spurious reduction of production declarator_noattrend -> direct_declarator -## In state 553, spurious reduction of production declare_varname(declarator_noattrend) -> declarator_noattrend -## In state 548, spurious reduction of production save_context -> -## In state 549, spurious reduction of production attribute_specifier_list -> -## In state 550, spurious reduction of production init_declarator -> declare_varname(declarator_noattrend) save_context attribute_specifier_list -## In state 547, spurious reduction of production init_declarator_list -> init_declarator_list COMMA init_declarator +## In state 263, spurious reduction of production declarator_noattrend -> direct_declarator +## In state 563, spurious reduction of production declare_varname(declarator_noattrend) -> declarator_noattrend +## In state 558, spurious reduction of production save_context -> +## In state 559, spurious reduction of production attribute_specifier_list -> +## In state 560, spurious reduction of production init_declarator -> declare_varname(declarator_noattrend) save_context attribute_specifier_list +## In state 557, spurious reduction of production init_declarator_list -> init_declarator_list COMMA init_declarator ## Up to this point, a list of declarators has been recognized: @@ -4076,14 +4076,14 @@ then at this point, a semicolon ';' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 546. +## Ends in an error in state: 556. ## ## init_declarator_list -> init_declarator_list COMMA . init_declarator [ SEMICOLON COMMA ] ## ## The known suffix of the stack is as follows: -## init_declarator_list COMMA +## init_declarator_list COMMA ## Ill-formed declaration. @@ -4091,23 +4091,23 @@ At this point, an init declarator is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE DOT PRE_NAME VAR_NAME EQ ALIGNAS +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE DOT PRE_NAME VAR_NAME EQ ALIGNAS ## -## Ends in an error in state: 366. +## Ends in an error in state: 374. ## ## initializer_list -> option(designation) . c_initializer [ RBRACE COMMA ] ## ## The known suffix of the stack is as follows: -## option(designation) +## option(designation) ## -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE PRE_NAME VAR_NAME COMMA DOT PRE_NAME VAR_NAME EQ ALIGNAS +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE PRE_NAME VAR_NAME COMMA DOT PRE_NAME VAR_NAME EQ ALIGNAS ## -## Ends in an error in state: 370. +## Ends in an error in state: 378. ## ## initializer_list -> initializer_list COMMA option(designation) . c_initializer [ RBRACE COMMA ] ## ## The known suffix of the stack is as follows: -## initializer_list COMMA option(designation) +## initializer_list COMMA option(designation) ## Ill-formed initializer list. @@ -4115,15 +4115,15 @@ At this point, an initializer is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE DOT PRE_NAME VAR_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE DOT PRE_NAME VAR_NAME XOR_ASSIGN ## -## Ends in an error in state: 373. +## Ends in an error in state: 381. ## ## designation -> designator_list . EQ [ TILDE STRING_LITERAL STAR SIZEOF PRE_NAME PLUS MINUS LPAREN LBRACE INC DEC CONSTANT BUILTIN_VA_ARG BUILTIN_OFFSETOF BANG AND ALIGNOF ] ## option(designator_list) -> designator_list . [ LBRACK DOT ] ## ## The known suffix of the stack is as follows: -## designator_list +## designator_list ## # We are expecting either one more designator, @@ -4137,14 +4137,14 @@ then at this point, an equals sign '=' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE DOT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE DOT XOR_ASSIGN ## -## Ends in an error in state: 326. +## Ends in an error in state: 334. ## ## designator -> DOT . general_identifier [ RPAREN LBRACK EQ DOT ] ## ## The known suffix of the stack is as follows: -## DOT +## DOT ## # clang gives examples of designators. @@ -4154,32 +4154,32 @@ At this point, the name of a struct or union member is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE LBRACK PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE LBRACK PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 324. +## Ends in an error in state: 332. ## ## designator -> LBRACK conditional_expression . RBRACK [ RPAREN LBRACK EQ DOT ] ## ## The known suffix of the stack is as follows: -## LBRACK conditional_expression +## LBRACK conditional_expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 154, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 79, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression ## Ill-formed designator. @@ -4190,14 +4190,14 @@ then at this point, a closing bracket ']' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE LBRACK XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE LBRACK XOR_ASSIGN ## -## Ends in an error in state: 323. +## Ends in an error in state: 331. ## ## designator -> LBRACK . conditional_expression RBRACK [ RPAREN LBRACK EQ DOT ] ## ## The known suffix of the stack is as follows: -## LBRACK +## LBRACK ## Ill-formed designator. @@ -4205,15 +4205,15 @@ At this point, a constant expression is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 369. +## Ends in an error in state: 377. ## ## initializer_list -> initializer_list COMMA . option(designation) c_initializer [ RBRACE COMMA ] ## option(COMMA) -> COMMA . [ RBRACE ] ## ## The known suffix of the stack is as follows: -## initializer_list COMMA +## initializer_list COMMA ## # This could be a trailing comma, in which case a closing brace is legal. @@ -4226,36 +4226,36 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE CONSTANT SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE CONSTANT SEMICOLON ## -## Ends in an error in state: 368. +## Ends in an error in state: 376. ## ## c_initializer -> LBRACE initializer_list . option(COMMA) RBRACE [ SEMICOLON RBRACE COMMA ] ## initializer_list -> initializer_list . COMMA option(designation) c_initializer [ RBRACE COMMA ] ## ## The known suffix of the stack is as follows: -## LBRACE initializer_list +## LBRACE initializer_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression -## In state 372, spurious reduction of production c_initializer -> assignment_expression -## In state 378, spurious reduction of production initializer_list -> option(designation) c_initializer +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression +## In state 380, spurious reduction of production c_initializer -> assignment_expression +## In state 386, spurious reduction of production initializer_list -> option(designation) c_initializer ## # Omitting the fact that the closing brace can be preceded with a comma. @@ -4268,14 +4268,14 @@ then at this point, a closing brace '}' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ LBRACE XOR_ASSIGN ## -## Ends in an error in state: 367. +## Ends in an error in state: 375. ## ## c_initializer -> LBRACE . initializer_list option(COMMA) RBRACE [ SEMICOLON RBRACE COMMA ] ## ## The known suffix of the stack is as follows: -## LBRACE +## LBRACE ## # An initializer list is expected. @@ -4289,14 +4289,14 @@ followed with an initializer, is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME EQ XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME EQ XOR_ASSIGN ## -## Ends in an error in state: 551. +## Ends in an error in state: 561. ## ## init_declarator -> declare_varname(declarator_noattrend) save_context attribute_specifier_list EQ . c_initializer [ SEMICOLON COMMA ] ## ## The known suffix of the stack is as follows: -## declare_varname(declarator_noattrend) save_context attribute_specifier_list EQ +## declare_varname(declarator_noattrend) save_context attribute_specifier_list EQ ## # clang and gcc expect an expression (incomplete). @@ -4306,33 +4306,33 @@ At this point, an initializer is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LBRACK CONSTANT SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LBRACK CONSTANT SEMICOLON ## -## Ends in an error in state: 243. +## Ends in an error in state: 251. ## ## optional(assignment_expression,RBRACK) -> assignment_expression . RBRACK [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## assignment_expression +## assignment_expression ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 158, spurious reduction of production unary_expression -> postfix_expression -## In state 162, spurious reduction of production cast_expression -> unary_expression -## In state 185, spurious reduction of production multiplicative_expression -> cast_expression -## In state 179, spurious reduction of production additive_expression -> multiplicative_expression -## In state 198, spurious reduction of production shift_expression -> additive_expression -## In state 175, spurious reduction of production relational_expression -> shift_expression -## In state 191, spurious reduction of production equality_expression -> relational_expression -## In state 207, spurious reduction of production and_expression -> equality_expression -## In state 215, spurious reduction of production exclusive_or_expression -> and_expression -## In state 216, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 217, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 201, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 199, spurious reduction of production conditional_expression -> logical_or_expression -## In state 220, spurious reduction of production assignment_expression -> conditional_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 87, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 145, spurious reduction of production assignment_expression -> conditional_expression ## # At the time of writing, optional(expression,RBRACK) is used only in direct @@ -4348,14 +4348,14 @@ then at this point, a closing bracket ']' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME COMMA XOR_ASSIGN ## -## Ends in an error in state: 282. +## Ends in an error in state: 290. ## ## identifier_list -> identifier_list COMMA . PRE_NAME VAR_NAME [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## identifier_list COMMA +## identifier_list COMMA ## # Strangely, gcc requests ')'. @@ -4365,14 +4365,14 @@ At this point, an identifier is expected. # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME COMMA PRE_NAME TYPEDEF_NAME +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME COMMA PRE_NAME TYPEDEF_NAME ## -## Ends in an error in state: 283. +## Ends in an error in state: 291. ## ## identifier_list -> identifier_list COMMA PRE_NAME . VAR_NAME [ RPAREN COMMA ] ## ## The known suffix of the stack is as follows: -## identifier_list COMMA PRE_NAME +## identifier_list COMMA PRE_NAME ## Ill-formed K&R function definition. @@ -4381,29 +4381,29 @@ The following type name is used as a K&R parameter name: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN INT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN INT XOR_ASSIGN ## -## Ends in an error in state: 586. +## Ends in an error in state: 596. ## ## declaration_specifiers(declaration(block_item)) -> type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN VOLATILE INT XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN VOLATILE INT XOR_ASSIGN ## -## Ends in an error in state: 591. +## Ends in an error in state: 601. ## ## declaration_specifiers(declaration(block_item)) -> rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_typedef_name) -> list(declaration_specifier_no_typedef_name) . declaration_specifier_no_typedef_name [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC STAR SIGNED SHORT SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) +## rlist(declaration_specifier_no_type) type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 584. +## Ends in an error in state: 594. ## ## declaration_specifiers(declaration(block_item)) -> typedef_name list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . storage_class_specifier_no_typedef [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] @@ -4412,11 +4412,11 @@ translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN PRE ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## typedef_name list(declaration_specifier_no_type) +## typedef_name list(declaration_specifier_no_type) ## -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN VOLATILE PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 589. +## Ends in an error in state: 599. ## ## declaration_specifiers(declaration(block_item)) -> rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) . [ STAR SEMICOLON PRE_NAME LPAREN ] ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . storage_class_specifier_no_typedef [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] @@ -4425,7 +4425,7 @@ translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN VOL ## list(declaration_specifier_no_type) -> list(declaration_specifier_no_type) . attribute_specifier [ VOLATILE STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) typedef_name list(declaration_specifier_no_type) ## # We omit the case of the empty list of declarators @@ -4439,21 +4439,21 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN VOLATILE XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN VOLATILE XOR_ASSIGN ## -## Ends in an error in state: 587. +## Ends in an error in state: 597. ## ## declaration_specifiers(declaration(block_item)) -> rlist(declaration_specifier_no_type) . typedef_name list(declaration_specifier_no_type) [ STAR SEMICOLON PRE_NAME LPAREN ] ## declaration_specifiers(declaration(block_item)) -> rlist(declaration_specifier_no_type) . type_specifier_no_typedef_name list(declaration_specifier_no_typedef_name) [ STAR SEMICOLON PRE_NAME LPAREN ] ## ## The known suffix of the stack is as follows: -## rlist(declaration_specifier_no_type) +## rlist(declaration_specifier_no_type) ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 125, spurious reduction of production rlist(declaration_specifier_no_type) -> type_qualifier_noattr +## In state 222, spurious reduction of production rlist(declaration_specifier_no_type) -> type_qualifier_noattr ## Ill-formed K&R parameter declaration. @@ -4464,16 +4464,16 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: VOID PRE_NAME TYPEDEF_NAME PACKED LPAREN CONSTANT RPAREN XOR_ASSIGN +translation_unit_file: VOID PRE_NAME TYPEDEF_NAME PACKED LPAREN CONSTANT RPAREN XOR_ASSIGN ## -## Ends in an error in state: 600. +## Ends in an error in state: 610. ## ## attribute_specifier_list -> attribute_specifier . attribute_specifier_list [ SEMICOLON LBRACE EQ COMMA ] ## rlist(declaration_specifier_no_type) -> attribute_specifier . [ VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT SIGNED SHORT PRE_NAME LONG INT FLOAT ENUM DOUBLE CHAR ] ## rlist(declaration_specifier_no_type) -> attribute_specifier . rlist(declaration_specifier_no_type) [ VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT SIGNED SHORT PRE_NAME LONG INT FLOAT ENUM DOUBLE CHAR ] ## ## The known suffix of the stack is as follows: -## attribute_specifier +## attribute_specifier ## # We have just parsed a list of attribute specifiers, but we cannot @@ -4497,15 +4497,15 @@ If this is the parameter declaration of a K&R function definition, # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT COMMA XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT COMMA XOR_ASSIGN ## -## Ends in an error in state: 141. +## Ends in an error in state: 238. ## ## parameter_list -> parameter_list COMMA . parameter_declaration [ RPAREN COMMA ] ## parameter_type_list -> parameter_list COMMA . ELLIPSIS [ RPAREN ] ## ## The known suffix of the stack is as follows: -## parameter_list COMMA +## parameter_list COMMA ## At this point, one of the following is expected: @@ -4514,27 +4514,27 @@ At this point, one of the following is expected: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME SEMICOLON +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN INT PRE_NAME VAR_NAME SEMICOLON ## -## Ends in an error in state: 140. +## Ends in an error in state: 237. ## ## parameter_list -> parameter_list . COMMA parameter_declaration [ RPAREN COMMA ] ## parameter_type_list -> parameter_list . [ RPAREN ] ## parameter_type_list -> parameter_list . COMMA ELLIPSIS [ RPAREN ] ## ## The known suffix of the stack is as follows: -## parameter_list +## parameter_list ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 255, spurious reduction of production declarator_noattrend -> direct_declarator -## In state 260, spurious reduction of production attribute_specifier_list -> -## In state 261, spurious reduction of production declarator -> declarator_noattrend attribute_specifier_list -## In state 277, spurious reduction of production declare_varname(declarator) -> declarator -## In state 276, spurious reduction of production parameter_declaration -> declaration_specifiers(parameter_declaration) declare_varname(declarator) -## In state 148, spurious reduction of production parameter_list -> parameter_declaration +## In state 263, spurious reduction of production declarator_noattrend -> direct_declarator +## In state 268, spurious reduction of production attribute_specifier_list -> +## In state 269, spurious reduction of production declarator -> declarator_noattrend attribute_specifier_list +## In state 285, spurious reduction of production declare_varname(declarator) -> declarator +## In state 284, spurious reduction of production parameter_declaration -> declaration_specifiers(parameter_declaration) declare_varname(declarator) +## In state 245, spurious reduction of production parameter_list -> parameter_declaration ## # We omit the possibility of an ellipsis. @@ -4550,14 +4550,14 @@ then at this point, a closing parenthesis ')' is expected. # ------------------------------------------------------------------------------ -translation_unit_file: PRE_NAME VAR_NAME +translation_unit_file: PRE_NAME VAR_NAME ## ## Ends in an error in state: 16. ## ## typedef_name -> PRE_NAME . TYPEDEF_NAME [ VOLATILE TYPEDEF STATIC STAR SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LBRACK INLINE EXTERN CONST COMMA COLON AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PRE_NAME +## PRE_NAME ## # This can only happen in a declaration @@ -4568,15 +4568,15 @@ The following identifier is used as a type, but has not been defined as such: # ------------------------------------------------------------------------------ -translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN INT SEMICOLON XOR_ASSIGN +translation_unit_file: INT PRE_NAME VAR_NAME LPAREN PRE_NAME VAR_NAME RPAREN INT SEMICOLON XOR_ASSIGN ## -## Ends in an error in state: 596. +## Ends in an error in state: 606. ## ## declaration_list -> declaration_list . kr_param_declaration [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT RESTRICT REGISTER PRE_NAME PACKED NORETURN LONG LBRACE INT INLINE FLOAT EXTERN ENUM DOUBLE CONST CHAR AUTO ATTRIBUTE ALIGNAS ] ## function_definition1 -> declaration_specifiers(declaration(external_declaration)) declare_varname(declarator_noattrend) save_context declaration_list . [ LBRACE ] ## ## The known suffix of the stack is as follows: -## declaration_specifiers(declaration(external_declaration)) declare_varname(declarator_noattrend) save_context declaration_list +## declaration_specifiers(declaration(external_declaration)) declare_varname(declarator_noattrend) save_context declaration_list ## # clang requests the function body; gcc requests a declaration :-) @@ -4587,7 +4587,7 @@ At this point, one of the following is expected: #------------------------------------------------------------------------------ -translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF XOR_ASSIGN +translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF XOR_ASSIGN ## ## Ends in an error in state: 52. ## @@ -4595,7 +4595,7 @@ translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF XOR_ASSIGN ## postfix_expression -> BUILTIN_OFFSETOF . LPAREN type_name COMMA general_identifier designator_list RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_OFFSETOF +## BUILTIN_OFFSETOF ## Ill-formed __builtin_offsetof. @@ -4603,7 +4603,7 @@ At this point, an opening parenthesis '(' is expected. #------------------------------------------------------------------------------ -translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN XOR_ASSIGN +translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN XOR_ASSIGN ## ## Ends in an error in state: 53. ## @@ -4611,7 +4611,7 @@ translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN XOR_ASSIGN ## postfix_expression -> BUILTIN_OFFSETOF LPAREN . type_name COMMA general_identifier designator_list RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_OFFSETOF LPAREN +## BUILTIN_OFFSETOF LPAREN ## Ill-formed __builtin_offsetof. @@ -4619,23 +4619,23 @@ At this point, a struct or union name is expected. #------------------------------------------------------------------------------ -translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID XOR_ASSIGN +translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID XOR_ASSIGN ## -## Ends in an error in state: 318. +## Ends in an error in state: 326. ## ## postfix_expression -> BUILTIN_OFFSETOF LPAREN type_name . COMMA general_identifier RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## postfix_expression -> BUILTIN_OFFSETOF LPAREN type_name . COMMA general_identifier designator_list RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_OFFSETOF LPAREN type_name +## BUILTIN_OFFSETOF LPAREN type_name ## ## WARNING: This example involves spurious reductions. ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). ## In state 67, spurious reduction of production specifier_qualifier_list(type_name) -> type_specifier_no_typedef_name list(specifier_qualifier_no_typedef_name) -## In state 306, spurious reduction of production option(abstract_declarator(type_name)) -> -## In state 312, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) +## In state 314, spurious reduction of production option(abstract_declarator(type_name)) -> +## In state 320, spurious reduction of production type_name -> specifier_qualifier_list(type_name) option(abstract_declarator(type_name)) ## Ill-formed __builtin_offsetof. @@ -4643,15 +4643,15 @@ At this point, a colon ',' is expected #------------------------------------------------------------------------------ -translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID COMMA XOR_ASSIGN +translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID COMMA XOR_ASSIGN ## -## Ends in an error in state: 319. +## Ends in an error in state: 327. ## ## postfix_expression -> BUILTIN_OFFSETOF LPAREN type_name COMMA . general_identifier RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## postfix_expression -> BUILTIN_OFFSETOF LPAREN type_name COMMA . general_identifier designator_list RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_OFFSETOF LPAREN type_name COMMA +## BUILTIN_OFFSETOF LPAREN type_name COMMA ## Ill-formed __builtin_offsetof. @@ -4659,15 +4659,15 @@ At this point, a member-designator is expected. #------------------------------------------------------------------------------ -translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID COMMA PRE_NAME TYPEDEF_NAME XOR_ASSIGN +translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID COMMA PRE_NAME TYPEDEF_NAME XOR_ASSIGN ## -## Ends in an error in state: 320. +## Ends in an error in state: 328. ## ## postfix_expression -> BUILTIN_OFFSETOF LPAREN type_name COMMA general_identifier . RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## postfix_expression -> BUILTIN_OFFSETOF LPAREN type_name COMMA general_identifier . designator_list RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_OFFSETOF LPAREN type_name COMMA general_identifier +## BUILTIN_OFFSETOF LPAREN type_name COMMA general_identifier ## Ill-formed __builtin_offsetof. @@ -4675,15 +4675,15 @@ At this point, a member-designator is expected. #------------------------------------------------------------------------------ -translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID COMMA PRE_NAME TYPEDEF_NAME LBRACK STRING_LITERAL RBRACK XOR_ASSIGN +translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID COMMA PRE_NAME TYPEDEF_NAME LBRACK STRING_LITERAL RBRACK XOR_ASSIGN ## -## Ends in an error in state: 329. +## Ends in an error in state: 337. ## ## option(designator_list) -> designator_list . [ LBRACK DOT ] ## postfix_expression -> BUILTIN_OFFSETOF LPAREN type_name COMMA general_identifier designator_list . RPAREN [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RBRACK RBRACE QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA COLON BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## BUILTIN_OFFSETOF LPAREN type_name COMMA general_identifier designator_list +## BUILTIN_OFFSETOF LPAREN type_name COMMA general_identifier designator_list ## @@ -4692,7 +4692,7 @@ At this point, a member-designator is expected. #------------------------------------------------------------------------------ -translation_unit_file: ALIGNAS LPAREN PRE_NAME XOR_ASSIGN +translation_unit_file: ALIGNAS LPAREN PRE_NAME XOR_ASSIGN ## ## Ends in an error in state: 29. ## @@ -4700,20 +4700,20 @@ translation_unit_file: ALIGNAS LPAREN PRE_NAME XOR_ASSIGN ## typedef_name -> PRE_NAME . TYPEDEF_NAME [ VOLATILE TYPEDEF STATIC STAR SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LBRACK INLINE EXTERN CONST COMMA AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PRE_NAME +## PRE_NAME ## -translation_unit_file: ALIGNAS LPAREN VOID LPAREN VOID LPAREN PRE_NAME XOR_ASSIGN +translation_unit_file: ALIGNAS LPAREN VOID LPAREN VOID LPAREN PRE_NAME XOR_ASSIGN ## -## Ends in an error in state: 147. +## Ends in an error in state: 244. ## ## declarator_identifier -> PRE_NAME . low_prec TYPEDEF_NAME [ RPAREN PACKED LPAREN LBRACK ATTRIBUTE ALIGNAS ] ## declarator_identifier -> PRE_NAME . VAR_NAME [ RPAREN PACKED LPAREN LBRACK ATTRIBUTE ALIGNAS ] ## typedef_name -> PRE_NAME . TYPEDEF_NAME [ VOLATILE STATIC STAR RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LBRACK INLINE EXTERN CONST COMMA AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PRE_NAME +## PRE_NAME ## -translation_unit_file: UNION PRE_NAME XOR_ASSIGN +translation_unit_file: UNION PRE_NAME XOR_ASSIGN ## ## Ends in an error in state: 40. ## @@ -4721,38 +4721,38 @@ translation_unit_file: UNION PRE_NAME XOR_ASSIGN ## typedef_name -> PRE_NAME . TYPEDEF_NAME [ XOR_ASSIGN VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF SUB_ASSIGN STRUCT STATIC STAR SLASH SIGNED SHORT SEMICOLON RPAREN RIGHT_ASSIGN RIGHT RESTRICT REGISTER RBRACK RBRACE QUESTION PTR PRE_NAME PLUS PERCENT PACKED OR_ASSIGN NORETURN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LONG LEQ LEFT_ASSIGN LEFT LBRACK LBRACE INT INLINE INC HAT GT GEQ FLOAT EXTERN EQEQ EQ ENUM DOUBLE DOT DIV_ASSIGN DEC CONST COMMA COLON CHAR BARBAR BAR AUTO ATTRIBUTE AND_ASSIGN ANDAND AND ALIGNAS ADD_ASSIGN ] ## ## The known suffix of the stack is as follows: -## PRE_NAME +## PRE_NAME ## -translation_unit_file: VOID PRE_NAME TYPEDEF_NAME LBRACE PRE_NAME XOR_ASSIGN +translation_unit_file: VOID PRE_NAME TYPEDEF_NAME LBRACE PRE_NAME XOR_ASSIGN ## -## Ends in an error in state: 433. +## Ends in an error in state: 442. ## ## general_identifier -> PRE_NAME . VAR_NAME [ COLON ] ## primary_expression -> PRE_NAME . VAR_NAME [ XOR_ASSIGN SUB_ASSIGN STAR SLASH SEMICOLON RIGHT_ASSIGN RIGHT QUESTION PTR PLUS PERCENT OR_ASSIGN NEQ MUL_ASSIGN MOD_ASSIGN MINUS LT LPAREN LEQ LEFT_ASSIGN LEFT LBRACK INC HAT GT GEQ EQEQ EQ DOT DIV_ASSIGN DEC COMMA BARBAR BAR AND_ASSIGN ANDAND AND ADD_ASSIGN ] ## typedef_name -> PRE_NAME . TYPEDEF_NAME [ VOLATILE TYPEDEF STATIC STAR SEMICOLON RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN INLINE EXTERN CONST COLON AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PRE_NAME +## PRE_NAME ## -translation_unit_file: VOID PRE_NAME TYPEDEF_NAME LPAREN PRE_NAME XOR_ASSIGN +translation_unit_file: VOID PRE_NAME TYPEDEF_NAME LPAREN PRE_NAME XOR_ASSIGN ## -## Ends in an error in state: 105. +## Ends in an error in state: 202. ## ## identifier_list -> PRE_NAME . VAR_NAME [ RPAREN COMMA ] ## typedef_name -> PRE_NAME . TYPEDEF_NAME [ VOLATILE STATIC STAR RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LBRACK INLINE EXTERN CONST COMMA AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PRE_NAME +## PRE_NAME ## -translation_unit_file: VOID PRE_NAME XOR_ASSIGN +translation_unit_file: VOID PRE_NAME XOR_ASSIGN ## -## Ends in an error in state: 93. +## Ends in an error in state: 190. ## ## declarator_identifier -> PRE_NAME . low_prec TYPEDEF_NAME [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## declarator_identifier -> PRE_NAME . VAR_NAME [ VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL STRUCT STATIC SIGNED SHORT SEMICOLON RPAREN RESTRICT REGISTER PRE_NAME PACKED NORETURN LPAREN LONG LBRACK LBRACE INT INLINE FLOAT EXTERN EQ ENUM DOUBLE CONST COMMA COLON CHAR AUTO ATTRIBUTE ALIGNAS ] ## ## The known suffix of the stack is as follows: -## PRE_NAME +## PRE_NAME ## # This is not supposed to be possible, since the Lexer can only emit a diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index 669ecf5e..6ba7ee39 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -57,7 +57,7 @@ AUTO REGISTER INLINE NORETURN CHAR SHORT INT LONG SIGNED UNSIGNED FLOAT DOUBLE UNDERSCORE_BOOL CONST VOLATILE VOID STRUCT UNION ENUM CASE DEFAULT IF ELSE SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN BUILTIN_VA_ARG ALIGNOF - ATTRIBUTE ALIGNAS PACKED ASM BUILTIN_OFFSETOF + ATTRIBUTE ALIGNAS PACKED ASM BUILTIN_OFFSETOF STATIC_ASSERT %token EOF @@ -404,6 +404,7 @@ expression: declaration(phantom): | declaration_specifiers(declaration(phantom)) init_declarator_list? SEMICOLON | declaration_specifiers_typedef typedef_declarator_list? SEMICOLON +| static_assert_declaration {} init_declarator_list: @@ -518,6 +519,7 @@ struct_declaration_list: struct_declaration: | specifier_qualifier_list(struct_declaration) struct_declarator_list? SEMICOLON +| static_assert_declaration {} (* As in the standard, except it also encodes the constraint described @@ -607,6 +609,10 @@ gcc_attribute_word: | PACKED {} +static_assert_declaration: +| STATIC_ASSERT LPAREN constant_expression COMMA STRING_LITERAL RPAREN SEMICOLON + {} + function_specifier: | INLINE | NORETURN -- cgit From 2af7c98c3d8cbe466ef78145ed09d20bc70669a6 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 21 Jul 2020 18:42:44 +0200 Subject: Updated handcrafted.messages. Added error descriptions for the new syntax errors introduced by '_Static_assert'. --- cparser/handcrafted.messages | 108 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/cparser/handcrafted.messages b/cparser/handcrafted.messages index a5f365dc..605e04dc 100644 --- a/cparser/handcrafted.messages +++ b/cparser/handcrafted.messages @@ -4689,6 +4689,114 @@ translation_unit_file: PACKED LPAREN BUILTIN_OFFSETOF LPAREN VOID COMMA PRE_NAME Ill-formed __builtin_offsetof. At this point, a member-designator is expected. +# ------------------------------------------------------------------------------ + +translation_unit_file: STATIC_ASSERT XOR_ASSIGN +## +## Ends in an error in state: 76. +## +## static_assert_declaration -> STATIC_ASSERT . LPAREN conditional_expression COMMA STRING_LITERAL RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## +## The known suffix of the stack is as follows: +## STATIC_ASSERT +## +Ill-formed _Static_assert. +At this point, an opening parenthesis '(' is expected. + +#------------------------------------------------------------------------------ + +translation_unit_file: STATIC_ASSERT LPAREN XOR_ASSIGN +## +## Ends in an error in state: 77. +## +## static_assert_declaration -> STATIC_ASSERT LPAREN . conditional_expression COMMA STRING_LITERAL RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## +## The known suffix of the stack is as follows: +## STATIC_ASSERT LPAREN +## + +Ill-formed _Static_assert. +At this point, a constant expression is expected. + +#------------------------------------------------------------------------------ + +translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL XOR_ASSIGN +## +## Ends in an error in state: 167. +## +## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression . COMMA STRING_LITERAL RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## +## The known suffix of the stack is as follows: +## STATIC_ASSERT LPAREN conditional_expression +## +## WARNING: This example involves spurious reductions. +## This implies that, although the LR(1) items shown above provide an +## accurate view of the past (what has been recognized so far), they +## may provide an INCOMPLETE view of the future (what was expected next). +## In state 80, spurious reduction of production primary_expression -> string_literals_list +## In state 82, spurious reduction of production postfix_expression -> primary_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 79, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## + +Ill-formed _Static_assert. +At this point, a comma ',' is expected. + +#------------------------------------------------------------------------------ + +translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL COMMA XOR_ASSIGN +## +## Ends in an error in state: 168. +## +## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA . STRING_LITERAL RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## +## The known suffix of the stack is as follows: +## STATIC_ASSERT LPAREN conditional_expression COMMA +## + +Ill-formed _Static_assert. +At this point, a string literal is expected. + +#------------------------------------------------------------------------------ + +translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL COMMA STRING_LITERAL XOR_ASSIGN +## +## Ends in an error in state: 169. +## +## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA STRING_LITERAL . RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## +## The known suffix of the stack is as follows: +## STATIC_ASSERT LPAREN conditional_expression COMMA STRING_LITERAL +## + +Ill-formed _Static_assert. +At this point, a closing parenthesis ')' is expected. + +#------------------------------------------------------------------------------ + +translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL COMMA STRING_LITERAL RPAREN XOR_ASSIGN +## +## Ends in an error in state: 170. +## +## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA STRING_LITERAL RPAREN . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## +## The known suffix of the stack is as follows: +## STATIC_ASSERT LPAREN conditional_expression COMMA STRING_LITERAL RPAREN +## + +Ill-formed _Static_assert. +At this point, a semicolon ';' is expected. #------------------------------------------------------------------------------ -- cgit From b23f94bd3a81dd585901d203f8939f494495674f Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 21 Jul 2020 19:20:48 +0200 Subject: cparser/handcrafted.messages: missing blank line --- cparser/handcrafted.messages | 1 + 1 file changed, 1 insertion(+) diff --git a/cparser/handcrafted.messages b/cparser/handcrafted.messages index 605e04dc..9b565b27 100644 --- a/cparser/handcrafted.messages +++ b/cparser/handcrafted.messages @@ -4700,6 +4700,7 @@ translation_unit_file: STATIC_ASSERT XOR_ASSIGN ## The known suffix of the stack is as follows: ## STATIC_ASSERT ## + Ill-formed _Static_assert. At this point, an opening parenthesis '(' is expected. -- cgit From 907a9042ffb8d21fece6fc8e663ce23d32aa8fa1 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 21 Jul 2020 19:47:42 +0200 Subject: More checks for __builtin_va_start (#250) We check that this builtin function is only called from within a variadic function and has the correct number of arguments. --- cparser/Elab.ml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cparser/Elab.ml b/cparser/Elab.ml index ab91ada2..940c6f14 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -1808,14 +1808,18 @@ let elab_expr ctx loc env a = (preprocessing) --> __builtin_va_arg(ap, ty) (elaboration) --> __builtin_va_arg(ap, sizeof(ty)) *) - | CALL((VARIABLE "__builtin_va_start" as a1), [a2; a3]) -> + | CALL((VARIABLE "__builtin_va_start" as a1), args) -> if not ctx.ctx_vararg then error "'va_start' used in function with fixed args"; - let b1,env = elab env a1 in - let b2,env = elab env a2 in - let _b3,env = elab env a3 in - { edesc = ECall(b1, [b2]); - etyp = TVoid [] },env + let b1, env = elab env a1 in + begin match args with + | [a2; a3] -> + let b2,env = elab env a2 in + let _b3,env = elab env a3 in + { edesc = ECall(b1, [b2]); + etyp = TVoid [] },env + | _ -> fatal_error "'__builtin_va_start' expects 2 arguments" + end | BUILTIN_VA_ARG (a2, a3) -> let ident = -- cgit From 465f6b4120bb38d2ef2871de4972df92ee935ed6 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 25 Jul 2020 10:37:05 +0200 Subject: No need to process __builtin_fabs in $ARCH/Asmexpand.ml __builtin_fabs has already been expanded in backend/Selection.v . --- aarch64/Asmexpand.ml | 2 -- arm/Asmexpand.ml | 2 -- powerpc/Asmexpand.ml | 2 -- riscV/Asmexpand.ml | 2 -- x86/Asmexpand.ml | 4 ---- 5 files changed, 12 deletions(-) diff --git a/aarch64/Asmexpand.ml b/aarch64/Asmexpand.ml index 471ad501..dcb2d1aa 100644 --- a/aarch64/Asmexpand.ml +++ b/aarch64/Asmexpand.ml @@ -347,8 +347,6 @@ let expand_builtin_inline name args res = | ("__builtin_clsl" | "__builtin_clsll"), [BA(IR a1)], BR(IR res) -> emit (Pcls(X, res, a1)) (* Float arithmetic *) - | "__builtin_fabs", [BA(FR a1)], BR(FR res) -> - emit (Pfabs(D, res, a1)) | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> emit (Pfsqrt(D, res, a1)) | "__builtin_fmadd", [BA(FR a1); BA(FR a2); BA(FR a3)], BR(FR res) -> diff --git a/arm/Asmexpand.ml b/arm/Asmexpand.ml index 89aab5c7..e1e72dbc 100644 --- a/arm/Asmexpand.ml +++ b/arm/Asmexpand.ml @@ -349,8 +349,6 @@ let expand_builtin_inline name args res = emit (Prsb(res, res, SOimm _32)); emit (Plabel lbl2) (* Float arithmetic *) - | "__builtin_fabs", [BA(FR a1)], BR(FR res) -> - emit (Pfabsd (res,a1)) | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> emit (Pfsqrt (res,a1)) (* 64-bit integer arithmetic *) diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index 1854ec16..9b7c3cc7 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -594,8 +594,6 @@ let expand_builtin_inline name args res = emit (Pfnmadd(res, a1, a2, a3)) | "__builtin_fnmsub", [BA(FR a1); BA(FR a2); BA(FR a3)], BR(FR res) -> emit (Pfnmsub(res, a1, a2, a3)) - | "__builtin_fabs", [BA(FR a1)], BR(FR res) -> - emit (Pfabs(res, a1)) | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> emit (Pfsqrt(res, a1)) | "__builtin_frsqrte", [BA(FR a1)], BR(FR res) -> diff --git a/riscV/Asmexpand.ml b/riscV/Asmexpand.ml index 7e36abf8..a6edfc1e 100644 --- a/riscV/Asmexpand.ml +++ b/riscV/Asmexpand.ml @@ -419,8 +419,6 @@ let expand_builtin_inline name args res = expand_bswap32 X5 X5; expand_bswap32 X6 X6 (* Float arithmetic *) - | "__builtin_fabs", [BA(FR a1)], BR(FR res) -> - emit (Pfabsd(res, a1)) | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> emit (Pfsqrtd(res, a1)) | "__builtin_fmadd", [BA(FR a1); BA(FR a2); BA(FR a3)], BR(FR res) -> diff --git a/x86/Asmexpand.ml b/x86/Asmexpand.ml index b8353046..e4cf028f 100644 --- a/x86/Asmexpand.ml +++ b/x86/Asmexpand.ml @@ -378,10 +378,6 @@ let expand_builtin_inline name args res = emit (Paddl_ri(res, coqint_of_camlint 32l)); emit (Plabel lbl2) (* Float arithmetic *) - | "__builtin_fabs", [BA(FR a1)], BR(FR res) -> - if a1 <> res then - emit (Pmovsd_ff (res,a1)); - emit (Pabsd res) (* This ensures that need_masks is set to true *) | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> emit (Psqrtsd (res,a1)) | "__builtin_fmax", [BA(FR a1); BA(FR a2)], BR(FR res) -> -- cgit From 4cf2fc41657fac51d806c14fdf481c7047e39df3 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 25 Jul 2020 10:38:18 +0200 Subject: Add support for __builtin_fabsf --- backend/Selection.v | 2 ++ backend/Selectionproof.v | 4 ++++ cfrontend/C2C.ml | 2 ++ common/Builtins0.v | 5 +++++ 4 files changed, 13 insertions(+) diff --git a/backend/Selection.v b/backend/Selection.v index 480b09a2..a5bef9ae 100644 --- a/backend/Selection.v +++ b/backend/Selection.v @@ -248,6 +248,8 @@ Function sel_known_builtin (bf: builtin_function) (args: exprlist) := Some (sel_select ty a1 a2 a3) | BI_standard BI_fabs, a1 ::: Enil => Some (SelectOp.absf a1) + | BI_standard BI_fabsf, a1 ::: Enil => + Some (SelectOp.absfs a1) | _, _ => None end. diff --git a/backend/Selectionproof.v b/backend/Selectionproof.v index a66bcf81..987926aa 100644 --- a/backend/Selectionproof.v +++ b/backend/Selectionproof.v @@ -394,6 +394,10 @@ Proof. inv ARGS; try discriminate. inv H0; try discriminate. inv SEL. simpl in SEM; inv SEM. apply eval_absf; auto. ++ (* fabsf *) + inv ARGS; try discriminate. inv H0; try discriminate. + inv SEL. + simpl in SEM; inv SEM. apply eval_absfs; auto. - eapply eval_platform_builtin; eauto. Qed. diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index 7f796fe3..75eeaf21 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -183,6 +183,8 @@ let builtins_generic = { (* Floating-point absolute value *) "__builtin_fabs", (TFloat(FDouble, []), [TFloat(FDouble, [])], false); + "__builtin_fabsf", + (TFloat(FFloat, []), [TFloat(FFloat, [])], false); (* Float arithmetic *) "__builtin_fsqrt", (TFloat(FDouble, []), [TFloat(FDouble, [])], false); diff --git a/common/Builtins0.v b/common/Builtins0.v index 8da98314..4afe6f1a 100644 --- a/common/Builtins0.v +++ b/common/Builtins0.v @@ -332,6 +332,7 @@ End LOOKUP. Inductive standard_builtin : Type := | BI_select (t: typ) | BI_fabs + | BI_fabsf | BI_fsqrt | BI_negl | BI_addl @@ -364,6 +365,7 @@ Definition standard_builtin_table : list (string * standard_builtin) := :: ("__builtin_sel", BI_select Tfloat) :: ("__builtin_sel", BI_select Tsingle) :: ("__builtin_fabs", BI_fabs) + :: ("__builtin_fabsf", BI_fabsf) :: ("__builtin_fsqrt", BI_fsqrt) :: ("__builtin_negl", BI_negl) :: ("__builtin_addl", BI_addl) @@ -396,6 +398,8 @@ Definition standard_builtin_sig (b: standard_builtin) : signature := mksignature (Tint :: t :: t :: nil) t cc_default | BI_fabs | BI_fsqrt => mksignature (Tfloat :: nil) Tfloat cc_default + | BI_fabsf => + mksignature (Tsingle :: nil) Tsingle cc_default | BI_negl => mksignature (Tlong :: nil) Tlong cc_default | BI_addl | BI_subl | BI_i64_umulh| BI_i64_smulh @@ -428,6 +432,7 @@ Program Definition standard_builtin_sem (b: standard_builtin) : builtin_sem (sig | _ => None end) _ _ | BI_fabs => mkbuiltin_n1t Tfloat Tfloat Float.abs + | BI_fabsf => mkbuiltin_n1t Tsingle Tsingle Float32.abs | BI_fsqrt => mkbuiltin_n1t Tfloat Tfloat Float.sqrt | BI_negl => mkbuiltin_n1t Tlong Tlong Int64.neg | BI_addl => mkbuiltin_v2t Tlong Val.addl _ _ -- cgit From 094ac30cfbc757dd633191513c05b0738993651d Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 25 Jul 2020 17:11:44 +0200 Subject: RISC-V implementation of __builtin_clz* and __builtin_ctz* Using binary search loops expanded at point of use. --- riscV/Asmexpand.ml | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++ riscV/Machregs.v | 25 ++++++++++++ 2 files changed, 134 insertions(+) diff --git a/riscV/Asmexpand.ml b/riscV/Asmexpand.ml index a6edfc1e..96fd3766 100644 --- a/riscV/Asmexpand.ml +++ b/riscV/Asmexpand.ml @@ -394,6 +394,90 @@ let expand_bswap64 d s = emit (Psrlil(X31, X s, coqint_of_camlint 56l)); emit (Porl(d, X X1, X X31)) +(* Count leading zeros. Algorithm 5-7 from Hacker's Delight, + re-rolled as a loop to produce more compact code. *) + +let expand_clz ~sixtyfour ~splitlong = + (* Input: X in X5 or (X5, X6) if splitlong + Result: N in X7 + Temporaries: S in X8, Y in X9 *) + let lbl1 = new_label() in + let lbl2 = new_label() in + (* N := bitsize of X's type (32 or 64) *) + expand_loadimm32 X7 (coqint_of_camlint + (if sixtyfour || splitlong then 64l else 32l)); + (* S := initial shift amount (16 or 32) *) + expand_loadimm32 X8 (coqint_of_camlint (if sixtyfour then 32l else 16l)); + if splitlong then begin + (* if (Xhigh == 0) goto lbl1 *) + emit (Pbeqw(X X6, X0, lbl1)); + (* N := 32 *) + expand_loadimm32 X7 (coqint_of_camlint 32l); + (* X := Xhigh *) + emit (Pmv(X5, X6)) + end; + (* lbl1: *) + emit (Plabel lbl1); + (* Y := X >> S *) + emit (if sixtyfour then Psrll(X9, X X5, X X8) else Psrlw(X9, X X5, X X8)); + (* if (Y == 0) goto lbl2 *) + emit (if sixtyfour then Pbeql(X X9, X0, lbl2) else Pbeqw(X X9, X0, lbl2)); + (* N := N - S *) + emit (Psubw(X7, X X7, X X8)); + (* X := Y *) + emit (Pmv(X5, X9)); + (* lbl2: *) + emit (Plabel lbl2); + (* S := S / 2 *) + emit (Psrliw(X8, X X8, _1)); + (* if (S != 0) goto lbl1; *) + emit (Pbnew(X X8, X0, lbl1)); + (* N := N - X *) + emit (Psubw(X7, X X7, X X5)) + +(* Count trailing zeros. Algorithm 5-14 from Hacker's Delight, + re-rolled as a loop to produce more compact code. *) + +let expand_ctz ~sixtyfour ~splitlong = + (* Input: X in X6 or (X5, X6) if splitlong + Result: N in X7 + Temporaries: S in X8, Y in X9 *) + let lbl1 = new_label() in + let lbl2 = new_label() in + (* N := bitsize of X's type (32 or 64) *) + expand_loadimm32 X7 (coqint_of_camlint + (if sixtyfour || splitlong then 64l else 32l)); + (* S := initial shift amount (16 or 32) *) + expand_loadimm32 X8 (coqint_of_camlint (if sixtyfour then 32l else 16l)); + if splitlong then begin + (* if (Xlow == 0) goto lbl1 *) + emit (Pbeqw(X X5, X0, lbl1)); + (* N := 32 *) + expand_loadimm32 X7 (coqint_of_camlint 32l); + (* X := Xlow *) + emit (Pmv(X6, X5)) + end; + (* lbl1: *) + emit (Plabel lbl1); + (* Y := X >> S *) + emit (if sixtyfour then Pslll(X9, X X6, X X8) else Psllw(X9, X X6, X X8)); + (* if (Y == 0) goto lbl2 *) + emit (if sixtyfour then Pbeql(X X9, X0, lbl2) else Pbeqw(X X9, X0, lbl2)); + (* N := N - S *) + emit (Psubw(X7, X X7, X X8)); + (* X := Y *) + emit (Pmv(X6, X9)); + (* lbl2: *) + emit (Plabel lbl2); + (* S := S / 2 *) + emit (Psrliw(X8, X X8, _1)); + (* if (S != 0) goto lbl1; *) + emit (Pbnew(X X8, X0, lbl1)); + (* N := N - most significant bit of X *) + emit (if sixtyfour then Psrlil(X6, X X6, coqint_of_camlint 63l) + else Psrliw(X6, X X6, coqint_of_camlint 31l)); + emit (Psubw(X7, X X7, X X6)) + (* Handling of compiler-inlined builtins *) let expand_builtin_inline name args res = @@ -418,6 +502,31 @@ let expand_builtin_inline name args res = assert (ah = X6 && al = X5 && rh = X5 && rl = X6); expand_bswap32 X5 X5; expand_bswap32 X6 X6 + (* Count zeros *) + | "__builtin_clz", [BA(IR a)], BR(IR res) -> + assert (a = X5 && res = X7); + expand_clz ~sixtyfour:false ~splitlong:false + | "__builtin_clzl", [BA(IR a)], BR(IR res) -> + assert (a = X5 && res = X7); + expand_clz ~sixtyfour:Archi.ptr64 ~splitlong:false + | "__builtin_clzll", [BA(IR a)], BR(IR res) -> + assert (a = X5 && res = X7); + expand_clz ~sixtyfour:true ~splitlong:false + | "__builtin_clzll", [BA_splitlong(BA(IR ah), BA(IR al))], BR(IR res) -> + assert (al = X5 && ah = X6 && res = X7); + expand_clz ~sixtyfour:false ~splitlong:true + | "__builtin_ctz", [BA(IR a)], BR(IR res) -> + assert (a = X6 && res = X7); + expand_ctz ~sixtyfour:false ~splitlong:false + | "__builtin_ctzl", [BA(IR a)], BR(IR res) -> + assert (a = X6 && res = X7); + expand_ctz ~sixtyfour:Archi.ptr64 ~splitlong:false + | "__builtin_ctzll", [BA(IR a)], BR(IR res) -> + assert (a = X6 && res = X7); + expand_ctz ~sixtyfour:true ~splitlong:false + | "__builtin_ctzll", [BA_splitlong(BA(IR ah), BA(IR al))], BR(IR res) -> + assert (al = X5 && ah = X6 && res = X7); + expand_ctz ~sixtyfour:false ~splitlong:true (* Float arithmetic *) | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> emit (Pfsqrtd(res, a1)) diff --git a/riscV/Machregs.v b/riscV/Machregs.v index d8bb4a4b..d469e594 100644 --- a/riscV/Machregs.v +++ b/riscV/Machregs.v @@ -194,6 +194,17 @@ Definition destroyed_by_builtin (ef: external_function): list mreg := match ef with | EF_inline_asm txt sg clob => destroyed_by_clobber clob | EF_memcpy sz al => R5 :: R6 :: R7 :: F0 :: nil + | EF_builtin name sg => + if string_dec name "__builtin_clz" + || string_dec name "__builtin_clzl" + || string_dec name "__builtin_clzll" then + R5 :: R8 :: R9 :: nil + else if string_dec name "__builtin_ctz" + || string_dec name "__builtin_ctzl" + || string_dec name "__builtin_ctzll" then + R6 :: R8 :: R9 :: nil + else + nil | _ => nil end. @@ -213,6 +224,20 @@ Definition mregs_for_builtin (ef: external_function): list (option mreg) * list( | EF_builtin name sg => if (negb Archi.ptr64) && string_dec name "__builtin_bswap64" then (Some R6 :: Some R5 :: nil, Some R5 :: Some R6 :: nil) + else if string_dec name "__builtin_clz" + || string_dec name "__builtin_clzl" then + (Some R5 :: nil, Some R7 :: nil) + else if string_dec name "__builtin_clzll" then + if Archi.ptr64 + then (Some R5 :: nil, Some R7 :: nil) + else (Some R6 :: Some R5 :: nil, Some R7 :: nil) + else if string_dec name "__builtin_ctz" + || string_dec name "__builtin_ctzl" then + (Some R6 :: nil, Some R7 :: nil) + else if string_dec name "__builtin_ctzll" then + if Archi.ptr64 + then (Some R6 :: nil, Some R7 :: nil) + else (Some R6 :: Some R5 :: nil, Some R7 :: nil) else (nil, nil) | _ => -- cgit From a56e0c65b08f0f7123630f3a1b415e67ef48c38e Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 25 Jul 2020 18:27:04 +0200 Subject: AArch64 implementation of __builtin_ctz* Using the "rbit" instruction (reverse bits). --- aarch64/Asm.v | 2 ++ aarch64/Asmexpand.ml | 8 +++++++- aarch64/TargetPrinter.ml | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/aarch64/Asm.v b/aarch64/Asm.v index 47cd3051..79232783 100644 --- a/aarch64/Asm.v +++ b/aarch64/Asm.v @@ -237,6 +237,7 @@ Inductive instruction: Type := | Pclz (sz: isize) (rd r1: ireg) (**r count leading zero bits *) | Prev (sz: isize) (rd r1: ireg) (**r reverse bytes *) | Prev16 (sz: isize) (rd r1: ireg) (**r reverse bytes in each 16-bit word *) + | Prbit (sz: isize) (rd r1: ireg) (**r reverse bits *) (** Conditional data processing *) | Pcsel (rd: ireg) (r1 r2: ireg) (c: testcond) (**r int conditional move *) | Pcset (rd: ireg) (c: testcond) (**r set to 1/0 if cond is true/false *) @@ -1107,6 +1108,7 @@ Definition exec_instr (f: function) (i: instruction) (rs: regset) (m: mem) : out | Pclz _ _ _ | Prev _ _ _ | Prev16 _ _ _ + | Prbit _ _ _ | Pfsqrt _ _ _ | Pfmadd _ _ _ _ _ | Pfmsub _ _ _ _ _ diff --git a/aarch64/Asmexpand.ml b/aarch64/Asmexpand.ml index dcb2d1aa..02c27053 100644 --- a/aarch64/Asmexpand.ml +++ b/aarch64/Asmexpand.ml @@ -337,7 +337,7 @@ let expand_builtin_inline name args res = | "__builtin_bswap16", [BA(IR a1)], BR(IR res) -> emit (Prev16(W, res, a1)); emit (Pandimm(W, res, RR0 res, Z.of_uint 0xFFFF)) - (* Count leading zeros and leading sign bits *) + (* Count leading zeros, leading sign bits, trailing zeros *) | "__builtin_clz", [BA(IR a1)], BR(IR res) -> emit (Pclz(W, res, a1)) | ("__builtin_clzl" | "__builtin_clzll"), [BA(IR a1)], BR(IR res) -> @@ -346,6 +346,12 @@ let expand_builtin_inline name args res = emit (Pcls(W, res, a1)) | ("__builtin_clsl" | "__builtin_clsll"), [BA(IR a1)], BR(IR res) -> emit (Pcls(X, res, a1)) + | "__builtin_ctz", [BA(IR a1)], BR(IR res) -> + emit (Prbit(W, res, a1)); + emit (Pclz(W, res, res)) + | ("__builtin_ctzl" | "__builtin_ctzll"), [BA(IR a1)], BR(IR res) -> + emit (Prbit(X, res, a1)); + emit (Pclz(X, res, res)) (* Float arithmetic *) | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> emit (Pfsqrt(D, res, a1)) diff --git a/aarch64/TargetPrinter.ml b/aarch64/TargetPrinter.ml index e54673dd..fec05cc6 100644 --- a/aarch64/TargetPrinter.ml +++ b/aarch64/TargetPrinter.ml @@ -375,6 +375,8 @@ module Target : TARGET = fprintf oc " rev %a, %a\n" ireg (sz, rd) ireg (sz, r1) | Prev16(sz, rd, r1) -> fprintf oc " rev16 %a, %a\n" ireg (sz, rd) ireg (sz, r1) + | Prbit(sz, rd, r1) -> + fprintf oc " rbit %a, %a\n" ireg (sz, rd) ireg (sz, r1) (* Conditional data processing *) | Pcsel(rd, r1, r2, c) -> fprintf oc " csel %a, %a, %a, %s\n" xreg rd xreg r1 xreg r2 (condition_name c) -- cgit From bc20d7c0d16d07790fb6eb608bf608237b0abbc3 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 25 Jul 2020 17:47:25 +0200 Subject: Move declarations of __builtin_clz* and __builtin_ctz* to C2C.ml These functions are now available on all targets. --- aarch64/CBuiltins.ml | 8 -------- arm/CBuiltins.ml | 13 ------------- cfrontend/C2C.ml | 12 ++++++++++++ powerpc/CBuiltins.ml | 12 ------------ x86/CBuiltins.ml | 13 ------------- 5 files changed, 12 insertions(+), 46 deletions(-) diff --git a/aarch64/CBuiltins.ml b/aarch64/CBuiltins.ml index dfd5b768..e2a9c87a 100644 --- a/aarch64/CBuiltins.ml +++ b/aarch64/CBuiltins.ml @@ -32,14 +32,6 @@ let builtins = { "__builtin_fence", (TVoid [], [], false); (* Integer arithmetic *) - "__builtin_bswap64", - (TInt(IULongLong, []), [TInt(IULongLong, [])], false); - "__builtin_clz", - (TInt(IInt, []), [TInt(IUInt, [])], false); - "__builtin_clzl", - (TInt(IInt, []), [TInt(IULong, [])], false); - "__builtin_clzll", - (TInt(IInt, []), [TInt(IULongLong, [])], false); "__builtin_cls", (TInt(IInt, []), [TInt(IInt, [])], false); "__builtin_clsl", diff --git a/arm/CBuiltins.ml b/arm/CBuiltins.ml index d6a1ea35..6462a8c5 100644 --- a/arm/CBuiltins.ml +++ b/arm/CBuiltins.ml @@ -22,19 +22,6 @@ let builtins = { "__builtin_va_list", TPtr(TVoid [], []) ]; builtin_functions = [ - (* Integer arithmetic *) - "__builtin_clz", - (TInt(IInt, []), [TInt(IUInt, [])], false); - "__builtin_clzl", - (TInt(IInt, []), [TInt(IULong, [])], false); - "__builtin_clzll", - (TInt(IInt, []), [TInt(IULongLong, [])], false); - "__builtin_ctz", - (TInt(IInt, []), [TInt(IUInt, [])], false); - "__builtin_ctzl", - (TInt(IInt, []), [TInt(IULong, [])], false); - "__builtin_ctzll", - (TInt(IInt, []), [TInt(IULongLong, [])], false); (* Memory accesses *) "__builtin_read16_reversed", (TInt(IUShort, []), [TPtr(TInt(IUShort, [AConst]), [])], false); diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index 75eeaf21..c7cd4937 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -180,6 +180,18 @@ let builtins_generic = { (TInt(IUInt, []), [TInt(IUInt, [])], false); "__builtin_bswap16", (TInt(IUShort, []), [TInt(IUShort, [])], false); + "__builtin_clz", + (TInt(IInt, []), [TInt(IUInt, [])], false); + "__builtin_clzl", + (TInt(IInt, []), [TInt(IULong, [])], false); + "__builtin_clzll", + (TInt(IInt, []), [TInt(IULongLong, [])], false); + "__builtin_ctz", + (TInt(IInt, []), [TInt(IUInt, [])], false); + "__builtin_ctzl", + (TInt(IInt, []), [TInt(IULong, [])], false); + "__builtin_ctzll", + (TInt(IInt, []), [TInt(IULongLong, [])], false); (* Floating-point absolute value *) "__builtin_fabs", (TFloat(FDouble, []), [TFloat(FDouble, [])], false); diff --git a/powerpc/CBuiltins.ml b/powerpc/CBuiltins.ml index e29a41f1..e0826877 100644 --- a/powerpc/CBuiltins.ml +++ b/powerpc/CBuiltins.ml @@ -28,18 +28,6 @@ let builtins = { (TInt(IInt, []), [TInt(IInt, []); TInt(IInt, [])], false); "__builtin_mulhwu", (TInt(IUInt, []), [TInt(IUInt, []); TInt(IUInt, [])], false); - "__builtin_clz", - (TInt(IInt, []), [TInt(IUInt, [])], false); - "__builtin_clzl", - (TInt(IInt, []), [TInt(IULong, [])], false); - "__builtin_clzll", - (TInt(IInt, []), [TInt(IULongLong, [])], false); - "__builtin_ctz", - (TInt(IInt, []), [TInt(IUInt, [])], false); - "__builtin_ctzl", - (TInt(IInt, []), [TInt(IULong, [])], false); - "__builtin_ctzll", - (TInt(IInt, []), [TInt(IULongLong, [])], false); "__builtin_cmpb", (TInt (IUInt, []), [TInt(IUInt, []);TInt(IUInt, [])], false); (* Integer arithmetic in 32/64-bit hybrid mode *) diff --git a/x86/CBuiltins.ml b/x86/CBuiltins.ml index e7f714c7..6820c089 100644 --- a/x86/CBuiltins.ml +++ b/x86/CBuiltins.ml @@ -30,19 +30,6 @@ let builtins = { "__builtin_va_list", va_list_type; ]; builtin_functions = [ - (* Integer arithmetic *) - "__builtin_clz", - (TInt(IInt, []), [TInt(IUInt, [])], false); - "__builtin_clzl", - (TInt(IInt, []), [TInt(IULong, [])], false); - "__builtin_clzll", - (TInt(IInt, []), [TInt(IULongLong, [])], false); - "__builtin_ctz", - (TInt(IInt, []), [TInt(IUInt, [])], false); - "__builtin_ctzl", - (TInt(IInt, []), [TInt(IULong, [])], false); - "__builtin_ctzll", - (TInt(IInt, []), [TInt(IULongLong, [])], false); (* Float arithmetic *) "__builtin_fmax", (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, [])], false); -- cgit From 70f105e623dddeb27be258fedb56bd0e9a59d190 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 25 Jul 2020 17:13:05 +0200 Subject: Refactor regression testing of built-in functions Share the testing code for built-in functions that are available on all target platforms. Improve testing of __builtin_clz* and __builtin_ctz* --- test/regression/Makefile | 2 +- test/regression/Results/builtins-aarch64 | 7 - test/regression/Results/builtins-arm | 6 - test/regression/Results/builtins-common | 390 +++++++++++++++++++++++++++++++ test/regression/Results/builtins-powerpc | 9 - test/regression/Results/builtins-riscV | 6 - test/regression/Results/builtins-x86 | 12 - test/regression/builtins-aarch64.c | 20 +- test/regression/builtins-arm.c | 10 +- test/regression/builtins-common.c | 52 +++++ test/regression/builtins-powerpc.c | 13 +- test/regression/builtins-riscV.c | 11 +- test/regression/builtins-x86.c | 19 -- 13 files changed, 447 insertions(+), 110 deletions(-) create mode 100644 test/regression/Results/builtins-common create mode 100644 test/regression/builtins-common.c diff --git a/test/regression/Makefile b/test/regression/Makefile index 8e8d8762..28439ed5 100644 --- a/test/regression/Makefile +++ b/test/regression/Makefile @@ -22,7 +22,7 @@ TESTS=int32 int64 floats floats-basics floats-lit \ TESTS_COMP=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \ bitfields5 bitfields6 bitfields7 bitfields8 \ - builtins-$(ARCH) packedstruct1 packedstruct2 alignas \ + builtins-common builtins-$(ARCH) packedstruct1 packedstruct2 alignas \ varargs1 varargs2 varargs3 sections alias aligned # Can run, both in compiled mode and in interpreter mode, diff --git a/test/regression/Results/builtins-aarch64 b/test/regression/Results/builtins-aarch64 index c70432d8..7e3575e5 100644 --- a/test/regression/Results/builtins-aarch64 +++ b/test/regression/Results/builtins-aarch64 @@ -1,14 +1,7 @@ -bswap(12345678) = 78563412 -bswap16(1234) = 3412 -bswap64(123456789abcdef0) = f0debc9a78563412 -clz(12345678) = 3 -clzll(12345678) = 35 -clzll(1234567812345678) = 3 cls(1234567) = 10 cls(-9999) = 17 clsll(1234567) = 42 clsll(-9999) = 49 -fsqrt(3.141590) = 1.772453 fmadd(3.141590, 2.718000, 1.414000) = 9.952842 fmsub(3.141590, 2.718000, 1.414000) = -7.124842 fnmadd(3.141590, 2.718000, 1.414000) = -9.952842 diff --git a/test/regression/Results/builtins-arm b/test/regression/Results/builtins-arm index f637fb16..bfdad28d 100644 --- a/test/regression/Results/builtins-arm +++ b/test/regression/Results/builtins-arm @@ -1,9 +1,3 @@ -bswap(12345678) = 78563412 -bswap16(1234) = 3412 -clz(12345678) = 3 -clzll(12345678) = 35 -clzll(1234567812345678) = 3 -clzll(78563412) = 33 fsqrt(3.141590) = 1.772453 read_16_rev = 3412 read_32_rev = efbeadde diff --git a/test/regression/Results/builtins-common b/test/regression/Results/builtins-common new file mode 100644 index 00000000..a40dc907 --- /dev/null +++ b/test/regression/Results/builtins-common @@ -0,0 +1,390 @@ +bswap(12345678) = 78563412 +bswap16(1234) = 3412 +bswap64(123456789abcdef0) = f0debc9a78563412 +clz(ffffffff) = 0 +clz(80000000) = 0 +clz(7fffffff) = 1 +clz(40000000) = 1 +clz(3fffffff) = 2 +clz(20000000) = 2 +clz(1fffffff) = 3 +clz(10000000) = 3 +clz(0fffffff) = 4 +clz(08000000) = 4 +clz(07ffffff) = 5 +clz(04000000) = 5 +clz(03ffffff) = 6 +clz(02000000) = 6 +clz(01ffffff) = 7 +clz(01000000) = 7 +clz(00ffffff) = 8 +clz(00800000) = 8 +clz(007fffff) = 9 +clz(00400000) = 9 +clz(003fffff) = 10 +clz(00200000) = 10 +clz(001fffff) = 11 +clz(00100000) = 11 +clz(000fffff) = 12 +clz(00080000) = 12 +clz(0007ffff) = 13 +clz(00040000) = 13 +clz(0003ffff) = 14 +clz(00020000) = 14 +clz(0001ffff) = 15 +clz(00010000) = 15 +clz(0000ffff) = 16 +clz(00008000) = 16 +clz(00007fff) = 17 +clz(00004000) = 17 +clz(00003fff) = 18 +clz(00002000) = 18 +clz(00001fff) = 19 +clz(00001000) = 19 +clz(00000fff) = 20 +clz(00000800) = 20 +clz(000007ff) = 21 +clz(00000400) = 21 +clz(000003ff) = 22 +clz(00000200) = 22 +clz(000001ff) = 23 +clz(00000100) = 23 +clz(000000ff) = 24 +clz(00000080) = 24 +clz(0000007f) = 25 +clz(00000040) = 25 +clz(0000003f) = 26 +clz(00000020) = 26 +clz(0000001f) = 27 +clz(00000010) = 27 +clz(0000000f) = 28 +clz(00000008) = 28 +clz(00000007) = 29 +clz(00000004) = 29 +clz(00000003) = 30 +clz(00000002) = 30 +clz(00000001) = 31 +clz(00000001) = 31 +clzll(ffffffffffffffff) = 0 +clzll(8000000000000000) = 0 +clzll(7fffffffffffffff) = 1 +clzll(4000000000000000) = 1 +clzll(3fffffffffffffff) = 2 +clzll(2000000000000000) = 2 +clzll(1fffffffffffffff) = 3 +clzll(1000000000000000) = 3 +clzll(0fffffffffffffff) = 4 +clzll(0800000000000000) = 4 +clzll(07ffffffffffffff) = 5 +clzll(0400000000000000) = 5 +clzll(03ffffffffffffff) = 6 +clzll(0200000000000000) = 6 +clzll(01ffffffffffffff) = 7 +clzll(0100000000000000) = 7 +clzll(00ffffffffffffff) = 8 +clzll(0080000000000000) = 8 +clzll(007fffffffffffff) = 9 +clzll(0040000000000000) = 9 +clzll(003fffffffffffff) = 10 +clzll(0020000000000000) = 10 +clzll(001fffffffffffff) = 11 +clzll(0010000000000000) = 11 +clzll(000fffffffffffff) = 12 +clzll(0008000000000000) = 12 +clzll(0007ffffffffffff) = 13 +clzll(0004000000000000) = 13 +clzll(0003ffffffffffff) = 14 +clzll(0002000000000000) = 14 +clzll(0001ffffffffffff) = 15 +clzll(0001000000000000) = 15 +clzll(0000ffffffffffff) = 16 +clzll(0000800000000000) = 16 +clzll(00007fffffffffff) = 17 +clzll(0000400000000000) = 17 +clzll(00003fffffffffff) = 18 +clzll(0000200000000000) = 18 +clzll(00001fffffffffff) = 19 +clzll(0000100000000000) = 19 +clzll(00000fffffffffff) = 20 +clzll(0000080000000000) = 20 +clzll(000007ffffffffff) = 21 +clzll(0000040000000000) = 21 +clzll(000003ffffffffff) = 22 +clzll(0000020000000000) = 22 +clzll(000001ffffffffff) = 23 +clzll(0000010000000000) = 23 +clzll(000000ffffffffff) = 24 +clzll(0000008000000000) = 24 +clzll(0000007fffffffff) = 25 +clzll(0000004000000000) = 25 +clzll(0000003fffffffff) = 26 +clzll(0000002000000000) = 26 +clzll(0000001fffffffff) = 27 +clzll(0000001000000000) = 27 +clzll(0000000fffffffff) = 28 +clzll(0000000800000000) = 28 +clzll(00000007ffffffff) = 29 +clzll(0000000400000000) = 29 +clzll(00000003ffffffff) = 30 +clzll(0000000200000000) = 30 +clzll(00000001ffffffff) = 31 +clzll(0000000100000000) = 31 +clzll(00000000ffffffff) = 32 +clzll(0000000080000000) = 32 +clzll(000000007fffffff) = 33 +clzll(0000000040000000) = 33 +clzll(000000003fffffff) = 34 +clzll(0000000020000000) = 34 +clzll(000000001fffffff) = 35 +clzll(0000000010000000) = 35 +clzll(000000000fffffff) = 36 +clzll(0000000008000000) = 36 +clzll(0000000007ffffff) = 37 +clzll(0000000004000000) = 37 +clzll(0000000003ffffff) = 38 +clzll(0000000002000000) = 38 +clzll(0000000001ffffff) = 39 +clzll(0000000001000000) = 39 +clzll(0000000000ffffff) = 40 +clzll(0000000000800000) = 40 +clzll(00000000007fffff) = 41 +clzll(0000000000400000) = 41 +clzll(00000000003fffff) = 42 +clzll(0000000000200000) = 42 +clzll(00000000001fffff) = 43 +clzll(0000000000100000) = 43 +clzll(00000000000fffff) = 44 +clzll(0000000000080000) = 44 +clzll(000000000007ffff) = 45 +clzll(0000000000040000) = 45 +clzll(000000000003ffff) = 46 +clzll(0000000000020000) = 46 +clzll(000000000001ffff) = 47 +clzll(0000000000010000) = 47 +clzll(000000000000ffff) = 48 +clzll(0000000000008000) = 48 +clzll(0000000000007fff) = 49 +clzll(0000000000004000) = 49 +clzll(0000000000003fff) = 50 +clzll(0000000000002000) = 50 +clzll(0000000000001fff) = 51 +clzll(0000000000001000) = 51 +clzll(0000000000000fff) = 52 +clzll(0000000000000800) = 52 +clzll(00000000000007ff) = 53 +clzll(0000000000000400) = 53 +clzll(00000000000003ff) = 54 +clzll(0000000000000200) = 54 +clzll(00000000000001ff) = 55 +clzll(0000000000000100) = 55 +clzll(00000000000000ff) = 56 +clzll(0000000000000080) = 56 +clzll(000000000000007f) = 57 +clzll(0000000000000040) = 57 +clzll(000000000000003f) = 58 +clzll(0000000000000020) = 58 +clzll(000000000000001f) = 59 +clzll(0000000000000010) = 59 +clzll(000000000000000f) = 60 +clzll(0000000000000008) = 60 +clzll(0000000000000007) = 61 +clzll(0000000000000004) = 61 +clzll(0000000000000003) = 62 +clzll(0000000000000002) = 62 +clzll(0000000000000001) = 63 +clzll(0000000000000001) = 63 +ctz(00000001) = 0 +ctz(ffffffff) = 0 +ctz(00000002) = 1 +ctz(fffffffe) = 1 +ctz(00000004) = 2 +ctz(fffffffc) = 2 +ctz(00000008) = 3 +ctz(fffffff8) = 3 +ctz(00000010) = 4 +ctz(fffffff0) = 4 +ctz(00000020) = 5 +ctz(ffffffe0) = 5 +ctz(00000040) = 6 +ctz(ffffffc0) = 6 +ctz(00000080) = 7 +ctz(ffffff80) = 7 +ctz(00000100) = 8 +ctz(ffffff00) = 8 +ctz(00000200) = 9 +ctz(fffffe00) = 9 +ctz(00000400) = 10 +ctz(fffffc00) = 10 +ctz(00000800) = 11 +ctz(fffff800) = 11 +ctz(00001000) = 12 +ctz(fffff000) = 12 +ctz(00002000) = 13 +ctz(ffffe000) = 13 +ctz(00004000) = 14 +ctz(ffffc000) = 14 +ctz(00008000) = 15 +ctz(ffff8000) = 15 +ctz(00010000) = 16 +ctz(ffff0000) = 16 +ctz(00020000) = 17 +ctz(fffe0000) = 17 +ctz(00040000) = 18 +ctz(fffc0000) = 18 +ctz(00080000) = 19 +ctz(fff80000) = 19 +ctz(00100000) = 20 +ctz(fff00000) = 20 +ctz(00200000) = 21 +ctz(ffe00000) = 21 +ctz(00400000) = 22 +ctz(ffc00000) = 22 +ctz(00800000) = 23 +ctz(ff800000) = 23 +ctz(01000000) = 24 +ctz(ff000000) = 24 +ctz(02000000) = 25 +ctz(fe000000) = 25 +ctz(04000000) = 26 +ctz(fc000000) = 26 +ctz(08000000) = 27 +ctz(f8000000) = 27 +ctz(10000000) = 28 +ctz(f0000000) = 28 +ctz(20000000) = 29 +ctz(e0000000) = 29 +ctz(40000000) = 30 +ctz(c0000000) = 30 +ctz(80000000) = 31 +ctz(80000000) = 31 +ctzll(0000000000000001) = 0 +ctzll(ffffffffffffffff) = 0 +ctzll(0000000000000002) = 1 +ctzll(fffffffffffffffe) = 1 +ctzll(0000000000000004) = 2 +ctzll(fffffffffffffffc) = 2 +ctzll(0000000000000008) = 3 +ctzll(fffffffffffffff8) = 3 +ctzll(0000000000000010) = 4 +ctzll(fffffffffffffff0) = 4 +ctzll(0000000000000020) = 5 +ctzll(ffffffffffffffe0) = 5 +ctzll(0000000000000040) = 6 +ctzll(ffffffffffffffc0) = 6 +ctzll(0000000000000080) = 7 +ctzll(ffffffffffffff80) = 7 +ctzll(0000000000000100) = 8 +ctzll(ffffffffffffff00) = 8 +ctzll(0000000000000200) = 9 +ctzll(fffffffffffffe00) = 9 +ctzll(0000000000000400) = 10 +ctzll(fffffffffffffc00) = 10 +ctzll(0000000000000800) = 11 +ctzll(fffffffffffff800) = 11 +ctzll(0000000000001000) = 12 +ctzll(fffffffffffff000) = 12 +ctzll(0000000000002000) = 13 +ctzll(ffffffffffffe000) = 13 +ctzll(0000000000004000) = 14 +ctzll(ffffffffffffc000) = 14 +ctzll(0000000000008000) = 15 +ctzll(ffffffffffff8000) = 15 +ctzll(0000000000010000) = 16 +ctzll(ffffffffffff0000) = 16 +ctzll(0000000000020000) = 17 +ctzll(fffffffffffe0000) = 17 +ctzll(0000000000040000) = 18 +ctzll(fffffffffffc0000) = 18 +ctzll(0000000000080000) = 19 +ctzll(fffffffffff80000) = 19 +ctzll(0000000000100000) = 20 +ctzll(fffffffffff00000) = 20 +ctzll(0000000000200000) = 21 +ctzll(ffffffffffe00000) = 21 +ctzll(0000000000400000) = 22 +ctzll(ffffffffffc00000) = 22 +ctzll(0000000000800000) = 23 +ctzll(ffffffffff800000) = 23 +ctzll(0000000001000000) = 24 +ctzll(ffffffffff000000) = 24 +ctzll(0000000002000000) = 25 +ctzll(fffffffffe000000) = 25 +ctzll(0000000004000000) = 26 +ctzll(fffffffffc000000) = 26 +ctzll(0000000008000000) = 27 +ctzll(fffffffff8000000) = 27 +ctzll(0000000010000000) = 28 +ctzll(fffffffff0000000) = 28 +ctzll(0000000020000000) = 29 +ctzll(ffffffffe0000000) = 29 +ctzll(0000000040000000) = 30 +ctzll(ffffffffc0000000) = 30 +ctzll(0000000080000000) = 31 +ctzll(ffffffff80000000) = 31 +ctzll(0000000100000000) = 32 +ctzll(ffffffff00000000) = 32 +ctzll(0000000200000000) = 33 +ctzll(fffffffe00000000) = 33 +ctzll(0000000400000000) = 34 +ctzll(fffffffc00000000) = 34 +ctzll(0000000800000000) = 35 +ctzll(fffffff800000000) = 35 +ctzll(0000001000000000) = 36 +ctzll(fffffff000000000) = 36 +ctzll(0000002000000000) = 37 +ctzll(ffffffe000000000) = 37 +ctzll(0000004000000000) = 38 +ctzll(ffffffc000000000) = 38 +ctzll(0000008000000000) = 39 +ctzll(ffffff8000000000) = 39 +ctzll(0000010000000000) = 40 +ctzll(ffffff0000000000) = 40 +ctzll(0000020000000000) = 41 +ctzll(fffffe0000000000) = 41 +ctzll(0000040000000000) = 42 +ctzll(fffffc0000000000) = 42 +ctzll(0000080000000000) = 43 +ctzll(fffff80000000000) = 43 +ctzll(0000100000000000) = 44 +ctzll(fffff00000000000) = 44 +ctzll(0000200000000000) = 45 +ctzll(ffffe00000000000) = 45 +ctzll(0000400000000000) = 46 +ctzll(ffffc00000000000) = 46 +ctzll(0000800000000000) = 47 +ctzll(ffff800000000000) = 47 +ctzll(0001000000000000) = 48 +ctzll(ffff000000000000) = 48 +ctzll(0002000000000000) = 49 +ctzll(fffe000000000000) = 49 +ctzll(0004000000000000) = 50 +ctzll(fffc000000000000) = 50 +ctzll(0008000000000000) = 51 +ctzll(fff8000000000000) = 51 +ctzll(0010000000000000) = 52 +ctzll(fff0000000000000) = 52 +ctzll(0020000000000000) = 53 +ctzll(ffe0000000000000) = 53 +ctzll(0040000000000000) = 54 +ctzll(ffc0000000000000) = 54 +ctzll(0080000000000000) = 55 +ctzll(ff80000000000000) = 55 +ctzll(0100000000000000) = 56 +ctzll(ff00000000000000) = 56 +ctzll(0200000000000000) = 57 +ctzll(fe00000000000000) = 57 +ctzll(0400000000000000) = 58 +ctzll(fc00000000000000) = 58 +ctzll(0800000000000000) = 59 +ctzll(f800000000000000) = 59 +ctzll(1000000000000000) = 60 +ctzll(f000000000000000) = 60 +ctzll(2000000000000000) = 61 +ctzll(e000000000000000) = 61 +ctzll(4000000000000000) = 62 +ctzll(c000000000000000) = 62 +ctzll(8000000000000000) = 63 +ctzll(8000000000000000) = 63 +fabs(3.141590) = 3.141590 +fabs(-3.141590) = 3.141590 +fsqrt(3.141590) = 1.772453 diff --git a/test/regression/Results/builtins-powerpc b/test/regression/Results/builtins-powerpc index a3c63ad6..a37bfc63 100644 --- a/test/regression/Results/builtins-powerpc +++ b/test/regression/Results/builtins-powerpc @@ -1,16 +1,7 @@ mulhw(12345678, deadbeef) = fda16776 mulhwu(12345678, deadbeef) = fd5bdee -clz(12345678) = 3 -clzll(12345678) = 35 -clzll(1234567812345678) = 3 -clzll(78563412) = 33 -bswap(12345678) = 78563412 -bswap16(1234) = 3412 fmadd(3.141590, 2.718000, 1.414000) = 9.952842 fmsub(3.141590, 2.718000, 1.414000) = 7.124842 -fabs(3.141590) = 3.141590 -fabs(-3.141590) = 3.141590 -fsqrt(3.141590) = 1.772453 frsqrte(3.141590) = OK fres(3.141590) = OK fsel(3.141590, 2.718000, 1.414000) = 2.718000 diff --git a/test/regression/Results/builtins-riscV b/test/regression/Results/builtins-riscV index 1576b252..a14b7677 100644 --- a/test/regression/Results/builtins-riscV +++ b/test/regression/Results/builtins-riscV @@ -1,12 +1,6 @@ -bswap16(1234) = 3412 -bswap32(12345678) = 78563412 -bswap64(123456789abcdef0) = f0debc9a78563412 fmadd(3.141590, 2.718000, 1.414000) = 9.952842 fmsub(3.141590, 2.718000, 1.414000) = 7.124842 fnmadd(3.141590, 2.718000, 1.414000) = -9.952842 fnmsub(3.141590, 2.718000, 1.414000) = -7.124842 -fabs(3.141590) = 3.141590 -fabs(-3.141590) = 3.141590 -fsqrt(3.141590) = 1.772453 fmax(3.141590, 2.718000) = 3.141590 fmin(3.141590, 2.718000) = 2.718000 diff --git a/test/regression/Results/builtins-x86 b/test/regression/Results/builtins-x86 index 393ac1fd..7cd8838b 100644 --- a/test/regression/Results/builtins-x86 +++ b/test/regression/Results/builtins-x86 @@ -1,15 +1,3 @@ -bswap(12345678) = 78563412 -bswap16(1234) = 3412 -bswap64(123456789abcdef0) = f0debc9a78563412 -clz(12345678) = 3 -clzll(12345678) = 35 -clzll(1234567812345678) = 3 -clzll(78563412) = 33 -ctz(1234) = 2 -ctzll(1234567812345678) = 3 -ctzll(1234567800000000) = 35 -ctzll(78563412) = 1 -fsqrt(3.141590) = 1.772453 fmin(3.141590, 2.718000) = 2.718000 fmax(3.141590, 2.718000) = 3.141590 read_16_rev = 3412 diff --git a/test/regression/builtins-aarch64.c b/test/regression/builtins-aarch64.c index 2cfa2d09..671f65e3 100644 --- a/test/regression/builtins-aarch64.c +++ b/test/regression/builtins-aarch64.c @@ -1,43 +1,25 @@ -/* Fun with builtin functions */ +/* AArch64-specific builtin functions */ #include int main(int argc, char ** argv) { - unsigned int x = 0x12345678; - unsigned int y = 0xDEADBEEF; - unsigned long long xx = 0x1234567812345678ULL; - unsigned long long yy = 0x1234567800000000ULL; - unsigned long long zz = 0x123456789ABCDEF0ULL; - unsigned z; double a = 3.14159; double b = 2.718; double c = 1.414; - unsigned short s = 0x1234; signed int u = 1234567; signed int v = -9999; - printf("bswap(%x) = %x\n", x, __builtin_bswap(x)); - printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); - printf("bswap64(%llx) = %llx\n", zz, __builtin_bswap64(zz)); - printf("clz(%x) = %d\n", x, __builtin_clz(x)); - printf("clzll(%llx) = %d\n", (unsigned long long) x, __builtin_clzll(x)); - printf("clzll(%llx) = %d\n", xx, __builtin_clzll(xx)); printf("cls(%d) = %d\n", u, __builtin_cls(u)); printf("cls(%d) = %d\n", v, __builtin_cls(v)); printf("clsll(%lld) = %d\n", (signed long long) u, __builtin_clsll(u)); printf("clsll(%lld) = %d\n", (signed long long) v, __builtin_clsll(v)); - printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); printf("fmadd(%f, %f, %f) = %f\n", a, b, c, __builtin_fmadd(a, b, c)); printf("fmsub(%f, %f, %f) = %f\n", a, b, c, __builtin_fmsub(a, b, c)); printf("fnmadd(%f, %f, %f) = %f\n", a, b, c, __builtin_fnmadd(a, b, c)); printf("fnmsub(%f, %f, %f) = %f\n", a, b, c, __builtin_fnmsub(a, b, c)); - /* Make sure that ignoring the result of a builtin - doesn't cause an internal error */ - (void) __builtin_bswap(x); - (void) __builtin_fsqrt(a); return 0; } diff --git a/test/regression/builtins-arm.c b/test/regression/builtins-arm.c index d06e8e5e..85b611e8 100644 --- a/test/regression/builtins-arm.c +++ b/test/regression/builtins-arm.c @@ -1,10 +1,9 @@ -/* Fun with builtins */ +/* ARM-specific builtins */ #include unsigned int x = 0x12345678; unsigned int y = 0xDEADBEEF; -unsigned long long xx = 0x1234567812345678ULL; double a = 3.14159; unsigned short s = 0x1234; @@ -12,13 +11,6 @@ int main(int argc, char ** argv) { unsigned z; - printf("bswap(%x) = %x\n", x, __builtin_bswap(x)); - printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); - printf("clz(%x) = %d\n", x, __builtin_clz(x)); - printf("clzll(%llx) = %d\n", (unsigned long long) x, __builtin_clzll(x)); - printf("clzll(%llx) = %d\n", xx, __builtin_clzll(xx)); - z = __builtin_bswap(x); - printf("clzll(%lx) = %d\n", z, __builtin_clzll(z)); printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); printf ("read_16_rev = %x\n", __builtin_read16_reversed(&s)); diff --git a/test/regression/builtins-common.c b/test/regression/builtins-common.c new file mode 100644 index 00000000..7d975f0a --- /dev/null +++ b/test/regression/builtins-common.c @@ -0,0 +1,52 @@ +/* Builtin functions that are implemented on all target processors */ + +#include + +unsigned int x = 0x12345678; +unsigned int y = 0xDEADBEEF; +unsigned long long xx = 0x123456789ABCDEF0ULL; +double a = 3.14159; +double b = 2.718; +double c = 1.414; +unsigned short s = 0x1234; + +int main(int argc, char ** argv) +{ + printf("bswap(%x) = %x\n", x, __builtin_bswap(x)); + printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); + printf("bswap64(%llx) = %llx\n", xx, __builtin_bswap64(xx)); + for (int i = 0; i < 32; i++) { + unsigned z = 0xFFFFFFFFU >> i; + printf("clz(%08x) = %d\n", z, __builtin_clz(z)); + z = 0x80000000U >> i; + printf("clz(%08x) = %d\n", z, __builtin_clz(z)); + } + for (int i = 0; i < 64; i++) { + unsigned long long z = 0xFFFFFFFFFFFFFFFFULL >> i; + printf("clzll(%016llx) = %d\n", z, __builtin_clzll(z)); + z = 0x8000000000000000ULL >> i; + printf("clzll(%016llx) = %d\n", z, __builtin_clzll(z)); + } + for (int i = 0; i < 32; i++) { + unsigned z = 1U << i; + printf("ctz(%08x) = %d\n", z, __builtin_ctz(z)); + z = 0xFFFFFFFFU << i; + printf("ctz(%08x) = %d\n", z, __builtin_ctz(z)); + } + for (int i = 0; i < 64; i++) { + unsigned long long z = 1ULL << i; + printf("ctzll(%016llx) = %d\n", z, __builtin_ctzll(z)); + z = 0xFFFFFFFFFFFFFFFFULL << i; + printf("ctzll(%016llx) = %d\n", z, __builtin_ctzll(z)); + } + printf("fabs(%f) = %f\n", a, __builtin_fabs(a)); + printf("fabs(%f) = %f\n", -a, __builtin_fabs(-a)); + printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); + + /* Make sure that ignoring the result of a builtin + doesn't cause an internal error */ + (void) __builtin_bswap(x); + (void) __builtin_fsqrt(a); + (void) __builtin_sel(a > 0.0, x, y); + return 0; +} diff --git a/test/regression/builtins-powerpc.c b/test/regression/builtins-powerpc.c index 8fd5818b..55809106 100644 --- a/test/regression/builtins-powerpc.c +++ b/test/regression/builtins-powerpc.c @@ -1,4 +1,4 @@ -/* Fun with builtins */ +/* PowerPC-specific builtins */ #include #include @@ -11,7 +11,6 @@ char * check_relative_error(double exact, double actual, double precision) unsigned int x = 0x12345678; unsigned int y = 0xDEADBEEF; -unsigned long long xx = 0x1234567812345678ULL; double a = 3.14159; double b = 2.718; double c = 1.414; @@ -23,19 +22,9 @@ int main(int argc, char ** argv) printf("mulhw(%x, %x) = %x\n", x, y, __builtin_mulhw(x, y)); printf("mulhwu(%x, %x) = %x\n", x, y, __builtin_mulhwu(x, y)); - printf("clz(%x) = %d\n", x, __builtin_clz(x)); - printf("clzll(%llx) = %d\n", (unsigned long long) x, __builtin_clzll(x)); - printf("clzll(%llx) = %d\n", xx, __builtin_clzll(xx)); - z = __builtin_bswap(x); - printf("clzll(%lx) = %d\n", z, __builtin_clzll(z)); - printf("bswap(%x) = %x\n", x, __builtin_bswap(x)); - printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); printf("fmadd(%f, %f, %f) = %f\n", a, b, c, __builtin_fmadd(a, b, c)); printf("fmsub(%f, %f, %f) = %f\n", a, b, c, __builtin_fmsub(a, b, c)); - printf("fabs(%f) = %f\n", a, __builtin_fabs(a)); - printf("fabs(%f) = %f\n", -a, __builtin_fabs(-a)); - printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); printf("frsqrte(%f) = %s\n", a, check_relative_error(1.0 / sqrt(a), __builtin_frsqrte(a), 1./32.)); printf("fres(%f) = %s\n", diff --git a/test/regression/builtins-riscV.c b/test/regression/builtins-riscV.c index c34fdf2c..acd98e49 100644 --- a/test/regression/builtins-riscV.c +++ b/test/regression/builtins-riscV.c @@ -1,4 +1,4 @@ -/* Fun with builtins */ +/* RISC-V specific builtin functions */ #include @@ -11,20 +11,11 @@ double c = 1.414; int main(int argc, char ** argv) { - printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); - printf("bswap32(%x) = %x\n", x, __builtin_bswap32(x)); - printf("bswap64(%llx) = %llx\n", zz, __builtin_bswap64(zz)); printf("fmadd(%f, %f, %f) = %f\n", a, b, c, __builtin_fmadd(a, b, c)); printf("fmsub(%f, %f, %f) = %f\n", a, b, c, __builtin_fmsub(a, b, c)); printf("fnmadd(%f, %f, %f) = %f\n", a, b, c, __builtin_fnmadd(a, b, c)); printf("fnmsub(%f, %f, %f) = %f\n", a, b, c, __builtin_fnmsub(a, b, c)); - printf("fabs(%f) = %f\n", a, __builtin_fabs(a)); - printf("fabs(%f) = %f\n", -a, __builtin_fabs(-a)); - printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); printf("fmax(%f, %f) = %f\n", a, b, __builtin_fmax(a, b)); printf("fmin(%f, %f) = %f\n", a, b, __builtin_fmin(a, b)); - /* Make sure that ignoring the result of a builtin - doesn't cause an internal error */ - (void) __builtin_fsqrt(a); return 0; } diff --git a/test/regression/builtins-x86.c b/test/regression/builtins-x86.c index 6233f9fd..05d3ab93 100644 --- a/test/regression/builtins-x86.c +++ b/test/regression/builtins-x86.c @@ -4,9 +4,6 @@ unsigned int x = 0x12345678; unsigned int y = 0xDEADBEEF; -unsigned long long xx = 0x1234567812345678ULL; -unsigned long long yy = 0x1234567800000000ULL; -unsigned long long zz = 0x123456789ABCDEF0ULL; double a = 3.14159; double b = 2.718; double c = 1.414; @@ -14,22 +11,6 @@ unsigned short s = 0x1234; int main(int argc, char ** argv) { - unsigned z; - - printf("bswap(%x) = %x\n", x, __builtin_bswap(x)); - printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); - printf("bswap64(%llx) = %llx\n", zz, __builtin_bswap64(zz)); - printf("clz(%x) = %d\n", x, __builtin_clz(x)); - printf("clzll(%llx) = %d\n", (unsigned long long) x, __builtin_clzll(x)); - printf("clzll(%llx) = %d\n", xx, __builtin_clzll(xx)); - z = __builtin_bswap(x); - printf("clzll(%lx) = %d\n", z, __builtin_clzll(z)); - printf("ctz(%x) = %d\n", s, __builtin_ctz(s)); - printf("ctzll(%llx) = %d\n", xx, __builtin_ctzll(xx)); - printf("ctzll(%llx) = %d\n", yy, __builtin_ctzll(yy)); - printf("ctzll(%lx) = %d\n", z, __builtin_ctzll(z)); - - printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); printf("fmin(%f, %f) = %f\n", a, b, __builtin_fmin(a, b)); printf("fmax(%f, %f) = %f\n", a, b, __builtin_fmax(a, b)); -- cgit From 77ce8ba291afa9f5629a160df440f9af6614f3ef Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 27 Jul 2020 09:54:00 +0200 Subject: Add __builtin_sqrt as synonymous for __builtin_fsqrt __builtin_sqrt (no "f") is the name used by GCC and Clang. --- aarch64/Asmexpand.ml | 2 +- arm/Asmexpand.ml | 2 +- cfrontend/C2C.ml | 2 ++ common/Builtins0.v | 1 + powerpc/Asmexpand.ml | 2 +- riscV/Asmexpand.ml | 2 +- x86/Asmexpand.ml | 2 +- 7 files changed, 8 insertions(+), 5 deletions(-) diff --git a/aarch64/Asmexpand.ml b/aarch64/Asmexpand.ml index 02c27053..ea2ee703 100644 --- a/aarch64/Asmexpand.ml +++ b/aarch64/Asmexpand.ml @@ -353,7 +353,7 @@ let expand_builtin_inline name args res = emit (Prbit(X, res, a1)); emit (Pclz(X, res, res)) (* Float arithmetic *) - | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> + | ("__builtin_fsqrt" | "__builtin_sqrt"), [BA(FR a1)], BR(FR res) -> emit (Pfsqrt(D, res, a1)) | "__builtin_fmadd", [BA(FR a1); BA(FR a2); BA(FR a3)], BR(FR res) -> emit (Pfmadd(D, res, a1, a2, a3)) diff --git a/arm/Asmexpand.ml b/arm/Asmexpand.ml index e1e72dbc..f4e79a37 100644 --- a/arm/Asmexpand.ml +++ b/arm/Asmexpand.ml @@ -349,7 +349,7 @@ let expand_builtin_inline name args res = emit (Prsb(res, res, SOimm _32)); emit (Plabel lbl2) (* Float arithmetic *) - | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> + | ("__builtin_fsqrt" | "__builtin_sqrt"), [BA(FR a1)], BR(FR res) -> emit (Pfsqrt (res,a1)) (* 64-bit integer arithmetic *) | "__builtin_negl", [BA_splitlong(BA(IR ah), BA(IR al))], diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index c7cd4937..2386eed9 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -200,6 +200,8 @@ let builtins_generic = { (* Float arithmetic *) "__builtin_fsqrt", (TFloat(FDouble, []), [TFloat(FDouble, [])], false); + "__builtin_sqrt", + (TFloat(FDouble, []), [TFloat(FDouble, [])], false); (* Block copy *) "__builtin_memcpy_aligned", (TVoid [], diff --git a/common/Builtins0.v b/common/Builtins0.v index 4afe6f1a..d84c9112 100644 --- a/common/Builtins0.v +++ b/common/Builtins0.v @@ -367,6 +367,7 @@ Definition standard_builtin_table : list (string * standard_builtin) := :: ("__builtin_fabs", BI_fabs) :: ("__builtin_fabsf", BI_fabsf) :: ("__builtin_fsqrt", BI_fsqrt) + :: ("__builtin_sqrt", BI_fsqrt) :: ("__builtin_negl", BI_negl) :: ("__builtin_addl", BI_addl) :: ("__builtin_subl", BI_subl) diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index 9b7c3cc7..d8cbd94e 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -594,7 +594,7 @@ let expand_builtin_inline name args res = emit (Pfnmadd(res, a1, a2, a3)) | "__builtin_fnmsub", [BA(FR a1); BA(FR a2); BA(FR a3)], BR(FR res) -> emit (Pfnmsub(res, a1, a2, a3)) - | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> + | ("__builtin_fsqrt" | "__builtin_sqrt"), [BA(FR a1)], BR(FR res) -> emit (Pfsqrt(res, a1)) | "__builtin_frsqrte", [BA(FR a1)], BR(FR res) -> emit (Pfrsqrte(res, a1)) diff --git a/riscV/Asmexpand.ml b/riscV/Asmexpand.ml index 96fd3766..810514a3 100644 --- a/riscV/Asmexpand.ml +++ b/riscV/Asmexpand.ml @@ -528,7 +528,7 @@ let expand_builtin_inline name args res = assert (al = X5 && ah = X6 && res = X7); expand_ctz ~sixtyfour:false ~splitlong:true (* Float arithmetic *) - | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> + | ("__builtin_fsqrt" | "__builtin_sqrt"), [BA(FR a1)], BR(FR res) -> emit (Pfsqrtd(res, a1)) | "__builtin_fmadd", [BA(FR a1); BA(FR a2); BA(FR a3)], BR(FR res) -> emit (Pfmaddd(res, a1, a2, a3)) diff --git a/x86/Asmexpand.ml b/x86/Asmexpand.ml index e4cf028f..caa9775a 100644 --- a/x86/Asmexpand.ml +++ b/x86/Asmexpand.ml @@ -378,7 +378,7 @@ let expand_builtin_inline name args res = emit (Paddl_ri(res, coqint_of_camlint 32l)); emit (Plabel lbl2) (* Float arithmetic *) - | "__builtin_fsqrt", [BA(FR a1)], BR(FR res) -> + | ("__builtin_fsqrt" | "__builtin_sqrt"), [BA(FR a1)], BR(FR res) -> emit (Psqrtsd (res,a1)) | "__builtin_fmax", [BA(FR a1); BA(FR a2)], BR(FR res) -> if res = a1 then -- cgit From 896310e89fd1e527d0fcf8162c50577db702fc13 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 27 Jul 2020 16:41:56 +0200 Subject: Add test for __builtin_sqrt and __builtin_fabsf --- test/regression/Results/builtins-common | 3 +++ test/regression/builtins-common.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/test/regression/Results/builtins-common b/test/regression/Results/builtins-common index a40dc907..8adf7bfb 100644 --- a/test/regression/Results/builtins-common +++ b/test/regression/Results/builtins-common @@ -387,4 +387,7 @@ ctzll(8000000000000000) = 63 ctzll(8000000000000000) = 63 fabs(3.141590) = 3.141590 fabs(-3.141590) = 3.141590 +fabsf(7.250000) = 7.250000 +fabsf(-7.250000) = 7.250000 fsqrt(3.141590) = 1.772453 +sqrt(3.141590) = 1.772453 diff --git a/test/regression/builtins-common.c b/test/regression/builtins-common.c index 7d975f0a..51d0584e 100644 --- a/test/regression/builtins-common.c +++ b/test/regression/builtins-common.c @@ -8,6 +8,7 @@ unsigned long long xx = 0x123456789ABCDEF0ULL; double a = 3.14159; double b = 2.718; double c = 1.414; +float f = 7.25; unsigned short s = 0x1234; int main(int argc, char ** argv) @@ -41,7 +42,10 @@ int main(int argc, char ** argv) } printf("fabs(%f) = %f\n", a, __builtin_fabs(a)); printf("fabs(%f) = %f\n", -a, __builtin_fabs(-a)); + printf("fabsf(%f) = %f\n", f, __builtin_fabsf(f)); + printf("fabsf(%f) = %f\n", -f, __builtin_fabsf(-f)); printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); + printf("sqrt(%f) = %f\n", a, __builtin_sqrt(a)); /* Make sure that ignoring the result of a builtin doesn't cause an internal error */ -- cgit From 0132b8aa669adc10e6ca953d10d5c0b861f304b1 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 27 Jul 2020 19:05:27 +0200 Subject: Allow string_literals_list in _Static_assert. Not all pre-processors concatenate string literal lists, however they are allowed in _Static_assert. This is similar to the rules for inline assembly etc. --- cparser/handcrafted.messages | 47 ++++++++++++++++++++++---------------------- cparser/pre_parser.mly | 2 +- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/cparser/handcrafted.messages b/cparser/handcrafted.messages index 9b565b27..23e90b3e 100644 --- a/cparser/handcrafted.messages +++ b/cparser/handcrafted.messages @@ -4695,7 +4695,7 @@ translation_unit_file: STATIC_ASSERT XOR_ASSIGN ## ## Ends in an error in state: 76. ## -## static_assert_declaration -> STATIC_ASSERT . LPAREN conditional_expression COMMA STRING_LITERAL RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## static_assert_declaration -> STATIC_ASSERT . LPAREN conditional_expression COMMA string_literals_list RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: ## STATIC_ASSERT @@ -4710,7 +4710,7 @@ translation_unit_file: STATIC_ASSERT LPAREN XOR_ASSIGN ## ## Ends in an error in state: 77. ## -## static_assert_declaration -> STATIC_ASSERT LPAREN . conditional_expression COMMA STRING_LITERAL RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## static_assert_declaration -> STATIC_ASSERT LPAREN . conditional_expression COMMA string_literals_list RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: ## STATIC_ASSERT LPAREN @@ -4725,7 +4725,7 @@ translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL XOR_ASSIGN ## ## Ends in an error in state: 167. ## -## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression . COMMA STRING_LITERAL RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression . COMMA string_literals_list RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: ## STATIC_ASSERT LPAREN conditional_expression @@ -4734,21 +4734,21 @@ translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL XOR_ASSIGN ## This implies that, although the LR(1) items shown above provide an ## accurate view of the past (what has been recognized so far), they ## may provide an INCOMPLETE view of the future (what was expected next). -## In state 80, spurious reduction of production primary_expression -> string_literals_list -## In state 82, spurious reduction of production postfix_expression -> primary_expression -## In state 83, spurious reduction of production unary_expression -> postfix_expression -## In state 79, spurious reduction of production cast_expression -> unary_expression -## In state 110, spurious reduction of production multiplicative_expression -> cast_expression -## In state 104, spurious reduction of production additive_expression -> multiplicative_expression -## In state 123, spurious reduction of production shift_expression -> additive_expression -## In state 100, spurious reduction of production relational_expression -> shift_expression -## In state 116, spurious reduction of production equality_expression -> relational_expression -## In state 132, spurious reduction of production and_expression -> equality_expression -## In state 140, spurious reduction of production exclusive_or_expression -> and_expression -## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression -## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression -## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression -## In state 124, spurious reduction of production conditional_expression -> logical_or_expression +## In state 80, spurious reduction of production primary_expression -> string_literals_list +## In state 82, spurious reduction of production postfix_expression -> primary_expression +## In state 83, spurious reduction of production unary_expression -> postfix_expression +## In state 79, spurious reduction of production cast_expression -> unary_expression +## In state 110, spurious reduction of production multiplicative_expression -> cast_expression +## In state 104, spurious reduction of production additive_expression -> multiplicative_expression +## In state 123, spurious reduction of production shift_expression -> additive_expression +## In state 100, spurious reduction of production relational_expression -> shift_expression +## In state 116, spurious reduction of production equality_expression -> relational_expression +## In state 132, spurious reduction of production and_expression -> equality_expression +## In state 140, spurious reduction of production exclusive_or_expression -> and_expression +## In state 141, spurious reduction of production inclusive_or_expression -> exclusive_or_expression +## In state 142, spurious reduction of production logical_and_expression -> inclusive_or_expression +## In state 126, spurious reduction of production logical_or_expression -> logical_and_expression +## In state 124, spurious reduction of production conditional_expression -> logical_or_expression ## Ill-formed _Static_assert. @@ -4760,7 +4760,7 @@ translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL COMMA XOR_ASSIGN ## ## Ends in an error in state: 168. ## -## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA . STRING_LITERAL RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA . string_literals_list RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: ## STATIC_ASSERT LPAREN conditional_expression COMMA @@ -4775,10 +4775,11 @@ translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL COMMA STRING_LITERAL ## ## Ends in an error in state: 169. ## -## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA STRING_LITERAL . RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA string_literals_list . RPAREN SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## string_literals_list -> string_literals_list . STRING_LITERAL [ STRING_LITERAL RPAREN ] ## ## The known suffix of the stack is as follows: -## STATIC_ASSERT LPAREN conditional_expression COMMA STRING_LITERAL +## STATIC_ASSERT LPAREN conditional_expression COMMA string_literals_list ## Ill-formed _Static_assert. @@ -4790,10 +4791,10 @@ translation_unit_file: STATIC_ASSERT LPAREN STRING_LITERAL COMMA STRING_LITERAL ## ## Ends in an error in state: 170. ## -## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA STRING_LITERAL RPAREN . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] +## static_assert_declaration -> STATIC_ASSERT LPAREN conditional_expression COMMA string_literals_list RPAREN . SEMICOLON [ WHILE VOLATILE VOID UNSIGNED UNION UNDERSCORE_BOOL TYPEDEF TILDE SWITCH STRUCT STRING_LITERAL STATIC_ASSERT STATIC STAR SIZEOF SIGNED SHORT SEMICOLON RETURN RESTRICT REGISTER RBRACE PRE_NAME PRAGMA PLUS PACKED NORETURN MINUS LPAREN LONG LBRACE INT INLINE INC IF GOTO FOR FLOAT EXTERN EOF ENUM DOUBLE DO DEFAULT DEC CONTINUE CONSTANT CONST CHAR CASE BUILTIN_VA_ARG BUILTIN_OFFSETOF BREAK BANG AUTO ATTRIBUTE ASM AND ALIGNOF ALIGNAS ] ## ## The known suffix of the stack is as follows: -## STATIC_ASSERT LPAREN conditional_expression COMMA STRING_LITERAL RPAREN +## STATIC_ASSERT LPAREN conditional_expression COMMA string_literals_list RPAREN ## Ill-formed _Static_assert. diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index 6ba7ee39..4b62b235 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -610,7 +610,7 @@ gcc_attribute_word: {} static_assert_declaration: -| STATIC_ASSERT LPAREN constant_expression COMMA STRING_LITERAL RPAREN SEMICOLON +| STATIC_ASSERT LPAREN constant_expression COMMA string_literals_list RPAREN SEMICOLON {} function_specifier: -- cgit From 338509aef7347fda5db4123d645bb52971fa8a91 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 29 Jul 2020 12:16:03 +0200 Subject: Remove support for x86-32 under macOS 32-bit executables cannot be built since XCode 10.0 (sep 2018). 32-bit executables cannot be executed since MacOS 10.15 (oct 2019). Better remove x86-32 support and fail at configuration time instead of at the end of the build. --- configure | 24 ------------------------ x86/TargetPrinter.ml | 24 +++--------------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/configure b/configure index 0919f34e..a02e561f 100755 --- a/configure +++ b/configure @@ -48,7 +48,6 @@ Supported targets: armeb-hardfloat (ARM, EABI using hardware FP registers, big endian) x86_32-linux (x86 32 bits, Linux) x86_32-bsd (x86 32 bits, BSD) - x86_32-macosx (x86 32 bits, MacOS X) x86_32-cygwin (x86 32 bits, Cygwin environment under Windows) x86_64-linux (x86 64 bits, Linux) x86_64-bsd (x86 64 bits, BSD) @@ -328,29 +327,6 @@ if test "$arch" = "x86" -a "$bitsize" = "32"; then libmath="-lm" system="linux" ;; - macosx) - # kernel major versions count upwards from 4 for OSX 10.0 to 15 for OSX 10.11 - kernel_major=`uname -r | cut -d "." -f 1` - - abi="macosx" - casm="${toolprefix}gcc" - casm_options="-arch i386 -c" - cc="${toolprefix}gcc -arch i386" - clinker="${toolprefix}gcc" - clinker_needs_no_pie=false - cprepro="${toolprefix}gcc" - cprepro_options="-std=c99 -arch i386 -U__GNUC__ -U__clang__ -U__BLOCKS__ '-D__attribute__(x)=' '-D__asm(x)=' '-D_Nullable=' '-D_Nonnull=' -E" - libmath="" - system="macosx" - - if [[ $kernel_major -gt 11 ]]; then - # OSX >= 10.8 - clinker_options="-arch i386 -Wl,-no_pie" - else - # OSX <= 10.7 - clinker_options="-arch i386" - fi - ;; *) echo "Error: invalid eabi/system '$target' for architecture IA32/X86_32." 1>&2 echo "$usage" 1>&2 diff --git a/x86/TargetPrinter.ml b/x86/TargetPrinter.ml index 6159437e..f0a54506 100644 --- a/x86/TargetPrinter.ml +++ b/x86/TargetPrinter.ml @@ -197,7 +197,7 @@ module MacOS_System : SYSTEM = if i || (not !Clflags.option_fcommon) then ".const" else "COMM" | Section_string -> ".const" | Section_literal -> ".literal8" - | Section_jumptable -> ".text" (* needed in 64 bits, not a problem in 32 bits *) + | Section_jumptable -> ".text" | Section_user(s, wr, ex) -> sprintf ".section \"%s\", %s, %s" (if wr then "__DATA" else "__TEXT") s @@ -216,32 +216,14 @@ module MacOS_System : SYSTEM = let print_align oc n = fprintf oc " .align %d\n" (log2 n) - let indirect_symbols : StringSet.t ref = ref StringSet.empty - let print_mov_rs oc rd id = - if Archi.ptr64 then begin - fprintf oc " movq %a@GOTPCREL(%%rip), %a\n" symbol id ireg64 rd - end else begin - let id = extern_atom id in - indirect_symbols := StringSet.add id !indirect_symbols; - fprintf oc " movl L%a$non_lazy_ptr, %a\n" raw_symbol id ireg rd - end + fprintf oc " movq %a@GOTPCREL(%%rip), %a\n" symbol id ireg64 rd let print_fun_info _ _ = () let print_var_info _ _ = () - let print_epilogue oc = - if not Archi.ptr64 then begin - fprintf oc " .section __IMPORT,__pointers,non_lazy_symbol_pointers\n"; - StringSet.iter - (fun s -> - fprintf oc "L%a$non_lazy_ptr:\n" raw_symbol s; - fprintf oc " .indirect_symbol %a\n" raw_symbol s; - fprintf oc " .long 0\n") - !indirect_symbols; - indirect_symbols := StringSet.empty - end + let print_epilogue oc = () let print_comm_decl oc name sz al = fprintf oc " .comm %a, %s, %d\n" -- cgit From 6903cff15e6a66982513f5fe1511ed70eb781cbd Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Thu, 30 Jul 2020 09:59:14 +0200 Subject: Add missing comment for print_version_file_and_exit --- driver/CommonOptions.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index 5993c68d..cbc04a44 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -32,6 +32,7 @@ let version_file_string tool_name = else Printf.sprintf "The CompCert %s,\nversion %s\n" tool_name Version.version +(* Print the version string to a file and exit the program *) let print_version_file_and_exit tool_name file = let oc = open_out_bin file in output_string oc (version_file_string tool_name); -- cgit From 970c5aa11a629d81abc893e7f0428b53e556ab30 Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Thu, 30 Jul 2020 10:59:25 +0200 Subject: Add comments we missed to sync to GitHub --- cparser/Elab.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 940c6f14..5c03410f 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -985,6 +985,7 @@ and elab_field_group env = function elab_name_group loc env (spec, List.map fst fieldlist) in if sto <> Storage_default then + (* This should actually never be triggered, catched by pre-parser *) error loc "non-default storage in struct or union"; if fieldlist = [] then (* This should actually never be triggered, empty structs are captured earlier *) @@ -2853,6 +2854,7 @@ let elab_definition (for_loop: bool) (local: bool) (nonstatic_inline: bool) (* "int f(int x) { ... }" *) (* "int f(x, y) double y; { ... }" *) | FUNDEF(spec, name, defs, body, loc) -> + (* This should actually never be triggered, catched by pre-parser *) if local then error loc "function definition is not allowed here"; let env1 = elab_fundef env spec name defs body loc in ([], env1) -- cgit From b6a7b8ee4a5711911b66be6ea4dba3742601b03c Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 4 Aug 2020 10:50:37 +0200 Subject: Add new static-assert token for deLexer utility; bug 29273 --- cparser/deLexer.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/cparser/deLexer.ml b/cparser/deLexer.ml index de0e9b6e..ee6976d4 100644 --- a/cparser/deLexer.ml +++ b/cparser/deLexer.ml @@ -116,6 +116,7 @@ let delex (symbol : string) : string = | "DOT" -> "." | "PRAGMA" -> "#pragma \n" | "BUILTIN_OFFSETOF" -> "__builtin_offsetof" + | "STATIC_ASSERT" -> "_Static_assert" | "EOF" -> "" (* this should be ok *) | _ -> raise Not_found (* this should not happen *) -- cgit From d9e1175be2e713232d06c80e9aed33032858e9c7 Mon Sep 17 00:00:00 2001 From: Maxime Dénès Date: Fri, 18 Sep 2020 16:52:21 +0200 Subject: Simplify two scripts in Zbits (#369) Previous scripts were relying on the order in which apply's HO unification performs reductions, for a goal that could be solved by reflexivity. --- lib/Zbits.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Zbits.v b/lib/Zbits.v index 27586aff..6f3acaab 100644 --- a/lib/Zbits.v +++ b/lib/Zbits.v @@ -266,7 +266,7 @@ Qed. Remark Ztestbit_shiftin_base: forall b x, Z.testbit (Zshiftin b x) 0 = b. Proof. - intros. rewrite Ztestbit_shiftin. apply zeq_true. omega. + intros. rewrite Ztestbit_shiftin; reflexivity. Qed. Remark Ztestbit_shiftin_succ: @@ -316,7 +316,7 @@ Qed. Remark Ztestbit_base: forall x, Z.testbit x 0 = Z.odd x. Proof. - intros. rewrite Ztestbit_eq. apply zeq_true. omega. + intros. rewrite Ztestbit_eq; reflexivity. Qed. Remark Ztestbit_succ: -- cgit From e7b938f620ddc1e10542727f7ec142f47f7090bf Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 27 Aug 2020 18:07:15 +0200 Subject: Check ptr arithmetic for ++ and -- Also: improve check for ptr - integer. (Added by Xavier Leroy ) --- cparser/Elab.ml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 5c03410f..bb9f8aca 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -1710,11 +1710,12 @@ let elab_expr ctx loc env a = let check_ptr_arith env ty s = match unroll env ty with | TVoid _ -> - error "illegal arithmetic on a pointer to void in binary '%c'" s + error "illegal arithmetic on a pointer to void in %s" s | TFun _ -> - error "illegal arithmetic on a pointer to the function type %a in binary '%c'" (print_typ env) ty s - | _ -> if incomplete_type env ty then - error "arithmetic on a pointer to an incomplete type %a in binary '%c'" (print_typ env) ty s + error "illegal arithmetic on a pointer to the function type %a in %s" (print_typ env) ty s + | _ -> + if incomplete_type env ty then + error "arithmetic on a pointer to an incomplete type %a in %s" (print_typ env) ty s in let check_static_var env id sto ty = @@ -2120,7 +2121,7 @@ let elab_expr ctx loc env a = | _, _ -> fatal_error "invalid operands to binary '+' (%a and %a)" (print_typ env) b1.etyp (print_typ env) b2.etyp in - check_ptr_arith env ty '+'; + check_ptr_arith env ty "binary '+'"; TPtr(ty, []) end in { edesc = EBinop(Oadd, b1, b2, tyres); etyp = tyres },env @@ -2135,20 +2136,20 @@ let elab_expr ctx loc env a = end else begin match wrap unroll loc env b1.etyp, wrap unroll loc env b2.etyp with | (TPtr(ty, a) | TArray(ty, _, a)), (TInt _ | TEnum _) -> - if not (wrap pointer_arithmetic_ok loc env ty) then - error "illegal pointer arithmetic in binary '-'"; + check_ptr_arith env ty "binary '-'"; (TPtr(ty, []), TPtr(ty, [])) | (TPtr(ty1, a1) | TArray(ty1, _, a1)), (TPtr(ty2, a2) | TArray(ty2, _, a2)) -> if not (compatible_types AttrIgnoreAll env ty1 ty2) then error "%a and %a are not pointers to compatible types" (print_typ env) b1.etyp (print_typ env) b1.etyp; - check_ptr_arith env ty1 '-'; - check_ptr_arith env ty2 '-'; + check_ptr_arith env ty1 "binary '-'"; + check_ptr_arith env ty2 "binary '-'"; if wrap sizeof loc env ty1 = Some 0 then error "subtraction between two pointers to zero-sized objects"; (TPtr(ty1, []), TInt(ptrdiff_t_ikind(), [])) - | _, _ -> fatal_error "invalid operands to binary '-' (%a and %a)" + | _, _ -> + fatal_error "invalid operands to binary '-' (%a and %a)" (print_typ env) b1.etyp (print_typ env) b2.etyp end in { edesc = EBinop(Osub, b1, b2, tyop); etyp = tyres },env @@ -2306,6 +2307,11 @@ let elab_expr ctx loc env a = error "expression is not assignable"; if not (is_scalar_type env b1.etyp) then error "cannot %s value of type %a" msg (print_typ env) b1.etyp; + begin match unroll env b1.etyp with + | TPtr (ty, _) | TArray (ty, _ , _) -> + check_ptr_arith env ty ("unary " ^ msg) + | _ -> () + end; { edesc = EUnop(op, b1); etyp = b1.etyp },env (* Elaboration of binary operators over integers *) -- cgit From b525fbe0915931a939d5851b511ce46fcf026236 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 21 Sep 2020 14:15:31 +0200 Subject: No need for -R options, _CoqProject contains them already --- coq | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/coq b/coq index fcf744fd..925bc4b9 100755 --- a/coq +++ b/coq @@ -1,10 +1,8 @@ #!/bin/sh -# Start coqide with the right -I options +# Start coqide with the right options # Use the Makefile to rebuild dependencies if needed # Recompile the modified file after coqide editing -INCLUDES=`make print-includes` - make -q ${1}o || { make -n ${1}o | grep -v "\\b${1}\\b" | \ (while read cmd; do @@ -12,4 +10,4 @@ make -q ${1}o || { done) } -"${COQBIN}coqide" -async-proofs off $INCLUDES $1 && make ${1}o +"${COQBIN}coqide" -async-proofs off $1 && make ${1}o -- cgit From ab0d9476db875a82cf293623d18552b62f239d5c Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 21 Sep 2020 14:15:57 +0200 Subject: Support the use of already-installed MenhirLib and Flocq libraries configure flags -use-external-Flocq and -use external-MenhirLib. --- Makefile | 30 +++++++++++++---- aarch64/Archi.v | 3 +- arm/Archi.v | 3 +- configure | 86 +++++++++++++++++++++++++------------------------ lib/Floats.v | 3 +- lib/IEEE754_extra.v | 4 +-- powerpc/Archi.v | 3 +- riscV/Archi.v | 3 +- test/clightgen/Makefile | 8 +++-- x86_32/Archi.v | 3 +- x86_64/Archi.v | 3 +- 11 files changed, 82 insertions(+), 67 deletions(-) diff --git a/Makefile b/Makefile index 127ed5d2..4b0b5761 100644 --- a/Makefile +++ b/Makefile @@ -27,14 +27,19 @@ else ARCHDIRS=$(ARCH)_$(BITSIZE) $(ARCH) endif -DIRS=lib common $(ARCHDIRS) backend cfrontend driver \ - flocq/Core flocq/Prop flocq/Calc flocq/IEEE754 \ - exportclight MenhirLib cparser +DIRS := lib common $(ARCHDIRS) backend cfrontend driver exportclight cparser -RECDIRS=lib common $(ARCHDIRS) backend cfrontend driver flocq exportclight \ - MenhirLib cparser +COQINCLUDES := $(foreach d, $(DIRS), -R $(d) compcert.$(d)) -COQINCLUDES=$(foreach d, $(RECDIRS), -R $(d) compcert.$(d)) +ifeq ($(LIBRARY_FLOCQ),local) +DIRS += flocq/Core flocq/Prop flocq/Calc flocq/IEEE754 +COQINCLUDES += -R flocq Flocq +endif + +ifeq ($(LIBRARY_MENHIRLIB),local) +DIRS += MenhirLib +COQINCLUDES += -R MenhirLib MenhirLib +endif COQCOPTS ?= -w -undeclared-scope -w -omega-is-deprecated COQC="$(COQBIN)coqc" -q $(COQINCLUDES) $(COQCOPTS) @@ -50,6 +55,7 @@ GPATH=$(DIRS) # Flocq +ifeq ($(LIBRARY_FLOCQ),local) FLOCQ=\ Raux.v Zaux.v Defs.v Digits.v Float_prop.v FIX.v FLT.v FLX.v FTZ.v \ Generic_fmt.v Round_pred.v Round_NE.v Ulp.v Core.v \ @@ -57,6 +63,9 @@ FLOCQ=\ Div_sqrt_error.v Mult_error.v Plus_error.v \ Relative.v Sterbenz.v Round_odd.v Double_rounding.v \ Binary.v Bits.v +else +FLOCQ= +endif # General-purpose libraries (in lib/) @@ -117,9 +126,13 @@ PARSER=Cabs.v Parser.v # MenhirLib +ifeq ($(LIBRARY_MENHIRLIB),local) MENHIRLIB=Alphabet.v Automaton.v Grammar.v Interpreter_complete.v \ Interpreter_correct.v Interpreter.v Main.v Validator_complete.v \ Validator_safe.v Validator_classes.v +else +MENHIRLIB= +endif # Putting everything together (in driver/) @@ -259,7 +272,7 @@ driver/Version.ml: VERSION cparser/Parser.v: cparser/Parser.vy @rm -f $@ - $(MENHIR) --coq --coq-lib-path compcert.MenhirLib --coq-no-version-check cparser/Parser.vy + $(MENHIR) --coq --coq-no-version-check cparser/Parser.vy @chmod a-w $@ depend: $(GENERATED) depend1 @@ -318,6 +331,9 @@ check-proof: $(FILES) print-includes: @echo $(COQINCLUDES) +CoqProject: + @echo $(COQINCLUDES) > _CoqProject + -include .depend FORCE: diff --git a/aarch64/Archi.v b/aarch64/Archi.v index 24431cb2..42500e70 100644 --- a/aarch64/Archi.v +++ b/aarch64/Archi.v @@ -15,9 +15,8 @@ (** Architecture-dependent parameters for AArch64 *) +From Flocq Require Import Binary Bits. Require Import ZArith List. -(*From Flocq*) -Require Import Binary Bits. Definition ptr64 := true. diff --git a/arm/Archi.v b/arm/Archi.v index 16d6c71d..2ca79710 100644 --- a/arm/Archi.v +++ b/arm/Archi.v @@ -16,9 +16,8 @@ (** Architecture-dependent parameters for ARM *) +From Flocq Require Import Binary Bits. Require Import ZArith List. -(*From Flocq*) -Require Import Binary Bits. Definition ptr64 := false. diff --git a/configure b/configure index a02e561f..a71901b8 100755 --- a/configure +++ b/configure @@ -27,6 +27,8 @@ clightgen=false install_coqdev=false responsefile="gnu" ignore_coq_version=false +library_Flocq=local +library_MenhirLib=local usage='Usage: ./configure [options] target For help on options and targets, do: ./configure -help @@ -84,6 +86,8 @@ Options: -libdir Install libraries in -coqdevdir Install Coq development (.vo files) in -toolprefix Prefix names of tools ("gcc", etc) with + -use-external-Flocq Use an already-installed Flocq library + -use-external-MenhirLib Use an already-installed MenhirLib library -no-runtime-lib Do not compile nor install the runtime support library -no-standard-headers Do not install nor use the standard .h headers -clightgen Also compile and install the clightgen tool @@ -124,6 +128,10 @@ while : ; do ignore_coq_version=true;; -install-coqdev|--install-coqdev|-install-coq-dev|--install-coq-dev) install_coqdev=true;; + -use-external-Flocq|--use-external-Flocq) + library_Flocq=external;; + -use-external-MenhirLib|--use-external-MenhirLib) + library_MenhirLib=external;; -help|--help) echo "$help"; exit 0;; -*) @@ -611,47 +619,6 @@ if $missingtools; then exit 2 fi -cat > .merlin < _CoqProject -case $arch in - x86) - echo "-R x86_${bitsize} compcert.x86_${bitsize}" >> _CoqProject - ;; -esac - # # Generate Makefile.config # @@ -694,6 +661,8 @@ LIBMATH=$libmath MODEL=$model SYSTEM=$system RESPONSEFILE=$responsefile +LIBRARY_FLOCQ=$library_Flocq +LIBRARY_MENHIRLIB=$library_MenhirLib EOF else cat >> Makefile.config <<'EOF' @@ -787,9 +756,41 @@ CLIGHTGEN=false # Whether the other tools support responsefiles in gnu syntax RESPONSEFILE="none" +# Whether to use the local copies of Flocq and MenhirLib +LIBRARY_FLOCQ=local # external +LIBRARY_MENHIRLIB=local # external EOF fi +# +# Generate Merlin and CoqProject files to simplify development +# +cat > .merlin < Date: Tue, 22 Sep 2020 17:03:03 +0200 Subject: Fix computation of next temporary in -canonical-idents mode Variables were confused for temporaries, causing the temporaries introduced by this pass to be very big integers. Fixes: #370 --- exportclight/Clightnorm.ml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/exportclight/Clightnorm.ml b/exportclight/Clightnorm.ml index a0001250..a6158b60 100644 --- a/exportclight/Clightnorm.ml +++ b/exportclight/Clightnorm.ml @@ -143,7 +143,18 @@ and norm_lbl_stmt ls = | LSnil -> LSnil | LScons(n, s, ls) -> LScons(n, norm_stmt s, norm_lbl_stmt ls) -let next_var curr (v, _) = if P.lt v curr then curr else P.succ v +(* In "canonical atoms" mode, temporaries are between 2^7 and 2^12 - 1. + Below 2^7 are single-letter identifiers and above 2^12 are all + other identifiers. *) + +let first_temp = P.of_int 128 +let last_temp = P.of_int 4095 + +let next_var curr (v, _) = + if P.lt v curr + || !use_canonical_atoms && (P.lt v first_temp || P.gt v last_temp) + then curr + else P.succ v let next_var_list vars start = List.fold_left next_var start vars -- cgit From 361726e23dc8ad15a61788349184e7790bec42c9 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 22 Sep 2020 17:05:16 +0200 Subject: Use exact arithmetic for printing positive numbers And also for the computations in name_temporary. Overflowing OCaml's integer types is unlikely in actual use but happened in the past owing to another mistake (see issue #370). --- exportclight/ExportClight.ml | 108 ++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/exportclight/ExportClight.ml b/exportclight/ExportClight.ml index 4a85b591..4ff901eb 100644 --- a/exportclight/ExportClight.ml +++ b/exportclight/ExportClight.ml @@ -43,6 +43,48 @@ let print_list fn p l = in plist l; fprintf p ")@]" +(* Numbers *) + +let coqint p n = + let n = camlint_of_coqint n in + if n >= 0l + then fprintf p "(Int.repr %ld)" n + else fprintf p "(Int.repr (%ld))" n + +let coqptrofs p n = + let s = Z.to_string n in + if Z.ge n Z.zero + then fprintf p "(Ptrofs.repr %s)" s + else fprintf p "(Ptrofs.repr (%s))" s + +let coqint64 p n = + let n = camlint64_of_coqint n in + if n >= 0L + then fprintf p "(Int64.repr %Ld)" n + else fprintf p "(Int64.repr (%Ld))" n + +let coqfloat p n = + fprintf p "(Float.of_bits %a)" coqint64 (Floats.Float.to_bits n) + +let coqsingle p n = + fprintf p "(Float32.of_bits %a)" coqint (Floats.Float32.to_bits n) + +let positive p n = + fprintf p "%s%%positive" (Z.to_string (Z.Zpos n)) + +let coqN p n = + fprintf p "%s%%N" (Z.to_string (Z.of_N n)) + +let coqZ p n = + if Z.ge n Z.zero + then fprintf p "%s" (Z.to_string n) + else fprintf p "(%s)" (Z.to_string n) + +(* Coq strings *) + +let coqstring p s = + fprintf p "\"%s\"" (camlstring_of_coqstring s) + (* Identifiers *) exception Not_an_identifier @@ -69,7 +111,7 @@ let ident p id = let s = Hashtbl.find temp_names id in fprintf p "%s" s with Not_found -> - fprintf p "%ld%%positive" (P.to_int32 id) + positive p id let iter_hashtbl_sorted (h: ('a, string) Hashtbl.t) (f: 'a * string -> unit) = List.iter f @@ -85,67 +127,29 @@ let define_idents p = fprintf p "Definition _%s : ident := $\"%s\".@ " (sanitize name) name else - fprintf p "Definition _%s : ident := %ld%%positive.@ " - (sanitize name) (P.to_int32 id) + fprintf p "Definition _%s : ident := %a.@ " + (sanitize name) positive id with Not_an_identifier -> ()); iter_hashtbl_sorted temp_names (fun (id, name) -> - fprintf p "Definition %s : ident := %ld%%positive.@ " - name (P.to_int32 id)); + fprintf p "Definition %s : ident := %a.@ " + name positive id); fprintf p "@ " let name_temporary t = if not (Hashtbl.mem string_of_atom t) && not (Hashtbl.mem temp_names t) then begin - let t1 = P.to_int t and t0 = P.to_int (first_unused_ident ()) in - Hashtbl.add temp_names t (sprintf "_t'%d" (t1 - t0 + 1)) + let t0 = first_unused_ident () in + let d = Z.succ (Z.sub (Z.Zpos t) (Z.Zpos t0)) in + Hashtbl.add temp_names t ("_t'" ^ Z.to_string d) end let name_opt_temporary = function | None -> () | Some id -> name_temporary id -(* Numbers *) - -let coqint p n = - let n = camlint_of_coqint n in - if n >= 0l - then fprintf p "(Int.repr %ld)" n - else fprintf p "(Int.repr (%ld))" n - -let coqptrofs p n = - let s = Z.to_string n in - if Z.ge n Z.zero - then fprintf p "(Ptrofs.repr %s)" s - else fprintf p "(Ptrofs.repr (%s))" s - -let coqint64 p n = - let n = camlint64_of_coqint n in - if n >= 0L - then fprintf p "(Int64.repr %Ld)" n - else fprintf p "(Int64.repr (%Ld))" n - -let coqfloat p n = - fprintf p "(Float.of_bits %a)" coqint64 (Floats.Float.to_bits n) - -let coqsingle p n = - fprintf p "(Float32.of_bits %a)" coqint (Floats.Float32.to_bits n) - -let coqN p n = - fprintf p "%ld%%N" (N.to_int32 n) - -let coqZ p n = - if Z.ge n Z.zero - then fprintf p "%s" (Z.to_string n) - else fprintf p "(%s)" (Z.to_string n) - -(* Coq strings *) - -let coqstring p s = - fprintf p "\"%s\"" (camlstring_of_coqstring s) - (* Raw attributes *) let attribute p a = @@ -269,14 +273,14 @@ let external_function p = function | EF_memcpy(sz, al) -> fprintf p "(EF_memcpy %ld %ld)" (Z.to_int32 sz) (Z.to_int32 al) | EF_annot(kind, text, targs) -> - fprintf p "(EF_annot %ld%%positive %a %a)" - (P.to_int32 kind) coqstring text (print_list asttype) targs + fprintf p "(EF_annot %a %a %a)" + positive kind coqstring text (print_list asttype) targs | EF_annot_val(kind, text, targ) -> - fprintf p "(EF_annot_val %ld%%positive %a %a)" - (P.to_int32 kind) coqstring text asttype targ + fprintf p "(EF_annot_val %a %a %a)" + positive kind coqstring text asttype targ | EF_debug(kind, text, targs) -> - fprintf p "(EF_debug %ld%%positive %ld%%positive %a)" - (P.to_int32 kind) (P.to_int32 text) (print_list asttype) targs + fprintf p "(EF_debug %a %a %a)" + positive kind positive text (print_list asttype) targs | EF_inline_asm(text, sg, clob) -> fprintf p "@[(EF_inline_asm %a@ %a@ %a)@]" coqstring text -- cgit From e9c738e3bd156f68905968e25c70ec796d3119c4 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 22 Sep 2020 17:06:58 +0200 Subject: Test clightgen with -short-idents and -normalize options Use different combination of options for different test files. --- test/clightgen/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/clightgen/Makefile b/test/clightgen/Makefile index fdfbc3fb..22c434b7 100644 --- a/test/clightgen/Makefile +++ b/test/clightgen/Makefile @@ -28,6 +28,12 @@ SRC+=arrays.c eval.c gmllexer.c gmlparser.c intersect.c light.c main.c \ CFLAGS=-DSYSTEM_$(SYSTEM) +aes.vo almabench.vo binarytrees.vo bisect.vo chomp.vo: CFLAGS += -short-idents + +fft.vo fftsp.vo fftw.vo fib.vo integr.vo knucleotide.vo: CFLAGS += -short-idents -normalize + +qsort.vo sha1.vo sha3.vo siphash24.vo spectral.vo vmach.vo: CFLAGS += -normalize + all: $(SRC:.c=.vo) test: -- cgit From 26ddb90280b45e92d90eead89edb237f2922824a Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 5 Oct 2020 15:52:58 +0200 Subject: Support Cygwin 64 bits - Add support for the Win64 ABI to the x86_64 port - Update vararg support to handle Win64 conventions - Configure support for x86_64-cygwin64 --- configure | 13 +++ runtime/x86_64/i64_dtou.S | 10 +-- runtime/x86_64/i64_utod.S | 18 ++--- runtime/x86_64/i64_utof.S | 18 ++--- runtime/x86_64/sysdeps.h | 18 ++++- runtime/x86_64/vararg.S | 63 ++++++++++++++- x86/Asm.v | 2 + x86/Asmexpand.ml | 91 +++++++++++++++++---- x86/CBuiltins.ml | 8 +- x86/ConstpropOp.vp | 5 +- x86/ConstpropOpproof.v | 2 +- x86/Conventions1.v | 200 +++++++++++++++++++++++++++++++++++----------- x86/Stacklayout.v | 22 ++--- x86/TargetPrinter.ml | 36 +++++++-- x86/extractionMachdep.v | 20 +++-- x86_32/Archi.v | 4 + x86_64/Archi.v | 3 + 17 files changed, 415 insertions(+), 118 deletions(-) diff --git a/configure b/configure index a71901b8..fcdbe803 100755 --- a/configure +++ b/configure @@ -54,6 +54,7 @@ Supported targets: x86_64-linux (x86 64 bits, Linux) x86_64-bsd (x86 64 bits, BSD) x86_64-macosx (x86 64 bits, MacOS X) + x86_64-cygwin (x86 64 bits, Cygwin environment under Windows) rv32-linux (RISC-V 32 bits, Linux) rv64-linux (RISC-V 64 bits, Linux) aarch64-linux (AArch64, i.e. ARMv8 in 64-bit mode, Linux) @@ -387,6 +388,18 @@ if test "$arch" = "x86" -a "$bitsize" = "64"; then libmath="" system="macosx" ;; + cygwin) + abi="standard" + casm="${toolprefix}gcc" + casm_options="-m64 -c" + cc="${toolprefix}gcc -m64" + clinker="${toolprefix}gcc" + clinker_options="-m64" + cprepro="${toolprefix}gcc" + cprepro_options="-std=c99 -m64 -U__GNUC__ '-D__attribute__(x)=' -E" + libmath="-lm" + system="cygwin" + ;; *) echo "Error: invalid eabi/system '$target' for architecture X86_64." 1>&2 echo "$usage" 1>&2 diff --git a/runtime/x86_64/i64_dtou.S b/runtime/x86_64/i64_dtou.S index cc822d67..7f12ae88 100644 --- a/runtime/x86_64/i64_dtou.S +++ b/runtime/x86_64/i64_dtou.S @@ -39,13 +39,13 @@ // Conversion float -> unsigned long FUNCTION(__compcert_i64_dtou) - ucomisd .LC1(%rip), %xmm0 + ucomisd .LC1(%rip), FP_ARG_1 jnb 1f - cvttsd2siq %xmm0, %rax + cvttsd2siq FP_ARG_1, INT_RES ret -1: subsd .LC1(%rip), %xmm0 - cvttsd2siq %xmm0, %rax - addq .LC2(%rip), %rax +1: subsd .LC1(%rip), FP_ARG_1 + cvttsd2siq FP_ARG_1, INT_RES + addq .LC2(%rip), INT_RES ret .p2align 3 diff --git a/runtime/x86_64/i64_utod.S b/runtime/x86_64/i64_utod.S index 62e6e484..4d4870fc 100644 --- a/runtime/x86_64/i64_utod.S +++ b/runtime/x86_64/i64_utod.S @@ -39,18 +39,18 @@ // Conversion unsigned long -> double-precision float FUNCTION(__compcert_i64_utod) - testq %rdi, %rdi + testq INT_ARG_1, INT_ARG_1 js 1f - pxor %xmm0, %xmm0 // if < 2^63, - cvtsi2sdq %rdi, %xmm0 // convert as if signed + pxor FP_RES, FP_RES // if < 2^63, + cvtsi2sdq INT_ARG_1, FP_RES // convert as if signed ret 1: // if >= 2^63, use round-to-odd trick - movq %rdi, %rax + movq INT_ARG_1, %rax shrq %rax - andq $1, %rdi - orq %rdi, %rax // (arg >> 1) | (arg & 1) - pxor %xmm0, %xmm0 - cvtsi2sdq %rax, %xmm0 // convert as if signed - addsd %xmm0, %xmm0 // multiply result by 2.0 + andq $1, INT_ARG_1 + orq INT_ARG_1, %rax // (arg >> 1) | (arg & 1) + pxor FP_RES, FP_RES + cvtsi2sdq %rax, FP_RES // convert as if signed + addsd FP_RES, FP_RES // multiply result by 2.0 ret ENDFUNCTION(__compcert_i64_utod) diff --git a/runtime/x86_64/i64_utof.S b/runtime/x86_64/i64_utof.S index 63a33920..0e878121 100644 --- a/runtime/x86_64/i64_utof.S +++ b/runtime/x86_64/i64_utof.S @@ -39,18 +39,18 @@ // Conversion unsigned long -> single-precision float FUNCTION(__compcert_i64_utof) - testq %rdi, %rdi + testq INT_ARG_1, INT_ARG_1 js 1f - pxor %xmm0, %xmm0 // if < 2^63, - cvtsi2ssq %rdi, %xmm0 // convert as if signed + pxor FP_RES, FP_RES // if < 2^63, + cvtsi2ssq INT_ARG_1, FP_RES // convert as if signed ret 1: // if >= 2^63, use round-to-odd trick - movq %rdi, %rax + movq INT_ARG_1, %rax shrq %rax - andq $1, %rdi - orq %rdi, %rax // (arg >> 1) | (arg & 1) - pxor %xmm0, %xmm0 - cvtsi2ssq %rax, %xmm0 // convert as if signed - addss %xmm0, %xmm0 // multiply result by 2.0 + andq $1, INT_ARG_1 + orq INT_ARG_1, %rax // (arg >> 1) | (arg & 1) + pxor FP_RES, FP_RES + cvtsi2ssq %rax, FP_RES // convert as if signed + addss FP_RES, FP_RES // multiply result by 2.0 ret ENDFUNCTION(__compcert_i64_utof) diff --git a/runtime/x86_64/sysdeps.h b/runtime/x86_64/sysdeps.h index e9d456af..aacef8f0 100644 --- a/runtime/x86_64/sysdeps.h +++ b/runtime/x86_64/sysdeps.h @@ -63,13 +63,25 @@ _##f: #if defined(SYS_cygwin) -#define GLOB(x) _##x +#define GLOB(x) x #define FUNCTION(f) \ .text; \ - .globl _##f; \ + .globl f; \ .align 16; \ -_##f: +f: #define ENDFUNCTION(f) #endif + +// Names for argument and result registers + +#if defined(SYS_cygwin) +#define INT_ARG_1 %rcx +#else +#define INT_ARG_1 %rdi +#endif +#define FP_ARG_1 %xmm0 +#define INT_RES %rax +#define FP_RES %xmm0 + diff --git a/runtime/x86_64/vararg.S b/runtime/x86_64/vararg.S index 9c0d787b..c5225b34 100644 --- a/runtime/x86_64/vararg.S +++ b/runtime/x86_64/vararg.S @@ -34,6 +34,12 @@ // Helper functions for variadic functions . x86_64 version. +#include "sysdeps.h" + +// ELF ABI + +#if defined(SYS_linux) || defined(SYS_bsd) || defined(SYS_macosx) + // typedef struct { // unsigned int gp_offset; // unsigned int fp_offset; @@ -60,8 +66,6 @@ // unsigned long long __compcert_va_int64(va_list ap); // double __compcert_va_float64(va_list ap); -#include "sysdeps.h" - FUNCTION(__compcert_va_int32) movl 0(%rdi), %edx // edx = gp_offset cmpl $48, %edx @@ -146,3 +150,58 @@ FUNCTION(__compcert_va_saveregs) movaps %xmm7, 160(%r10) 1: ret ENDFUNCTION(__compcert_va_saveregs) + +#endif + +// Windows ABI + +#if defined(SYS_cygwin) + +// typedef void * va_list; +// unsigned int __compcert_va_int32(va_list * ap); +// unsigned long long __compcert_va_int64(va_list * ap); +// double __compcert_va_float64(va_list * ap); + +FUNCTION(__compcert_va_int32) // %rcx = pointer to argument pointer + movq 0(%rcx), %rdx // %rdx = current argument pointer + movl 0(%rdx), %eax // load the int32 value there + addq $8, %rdx // increment argument pointer by 8 + movq %rdx, 0(%rcx) + ret +ENDFUNCTION(__compcert_va_int32) + +FUNCTION(__compcert_va_int64) // %rcx = pointer to argument pointer + movq 0(%rcx), %rdx // %rdx = current argument pointer + movq 0(%rdx), %rax // load the int64 value there + addq $8, %rdx // increment argument pointer by 8 + movq %rdx, 0(%rcx) + ret +ENDFUNCTION(__compcert_va_int64) + +FUNCTION(__compcert_va_float64) // %rcx = pointer to argument pointer + movq 0(%rcx), %rdx // %rdx = current argument pointer + movsd 0(%rdx), %xmm0 // load the float64 value there + addq $8, %rdx // increment argument pointer by 8 + movq %rdx, 0(%rcx) + ret +ENDFUNCTION(__compcert_va_float64) + +FUNCTION(__compcert_va_composite) + jmp GLOB(__compcert_va_int64) // by-ref convention, FIXME +ENDFUNCTION(__compcert_va_composite) + +// Save arguments passed in register in the stack at beginning of vararg +// function. The caller of the vararg function reserved 32 bytes of stack +// just for this purpose. +// FP arguments are passed both in FP registers and integer registers, +// so it's enough to save the integer registers used for parameter passing. + +FUNCTION(__compcert_va_saveregs) + movq %rcx, 16(%rsp) + movq %rdx, 24(%rsp) + movq %r8, 32(%rsp) + movq %r9, 40(%rsp) + ret +ENDFUNCTION(__compcert_va_saveregs) + +#endif diff --git a/x86/Asm.v b/x86/Asm.v index 58e28c40..33f1f2ad 100644 --- a/x86/Asm.v +++ b/x86/Asm.v @@ -279,6 +279,7 @@ Inductive instruction: Type := | Pmaxsd (rd: freg) (r2: freg) | Pminsd (rd: freg) (r2: freg) | Pmovb_rm (rd: ireg) (a: addrmode) + | Pmovq_rf (rd: ireg) (r1: freg) | Pmovsq_mr (a: addrmode) (rs: freg) | Pmovsq_rm (rd: freg) (a: addrmode) | Pmovsb @@ -998,6 +999,7 @@ Definition exec_instr (f: function) (i: instruction) (rs: regset) (m: mem) : out | Pmaxsd _ _ | Pminsd _ _ | Pmovb_rm _ _ + | Pmovq_rf _ _ | Pmovsq_rm _ _ | Pmovsq_mr _ _ | Pmovsb diff --git a/x86/Asmexpand.ml b/x86/Asmexpand.ml index caa9775a..73efc3c5 100644 --- a/x86/Asmexpand.ml +++ b/x86/Asmexpand.ml @@ -44,7 +44,7 @@ let stack_alignment () = 16 let _Plea (r, addr) = if Archi.ptr64 then Pleaq (r, addr) else Pleal (r, addr) -(* SP adjustment to allocate or free a stack frame *) +(* SP adjustment to allocate or free a stack frame. *) let align n a = if n >= 0 then (n + a - 1) land (-a) else n land (-a) @@ -56,7 +56,7 @@ let sp_adjustment_32 sz = (* The top 4 bytes have already been allocated by the "call" instruction. *) sz - 4 -let sp_adjustment_64 sz = +let sp_adjustment_elf64 sz = let sz = Z.to_int sz in if is_current_function_variadic() then begin (* If variadic, add room for register save area, which must be 16-aligned *) @@ -73,6 +73,13 @@ let sp_adjustment_64 sz = (sz - 8, -1) end +let sp_adjustment_win64 sz = + let sz = Z.to_int sz in + (* Preserve proper alignment of the stack *) + let sz = align sz 16 in + (* The top 8 bytes have already been allocated by the "call" instruction. *) + sz - 8 + (* Built-ins. They come in two flavors: - annotation statements: take their arguments in registers or stack locations; generate no code; @@ -256,7 +263,7 @@ let expand_builtin_va_start_32 r = emit (Pleal (RAX, linear_addr RSP (Z.of_uint32 ofs))); emit (Pmovl_mr (linear_addr r _0z, RAX)) -let expand_builtin_va_start_64 r = +let expand_builtin_va_start_elf64 r = if not (is_current_function_variadic ()) then invalid_arg "Fatal error: va_start used in non-vararg function"; let (ir, fr, ofs) = @@ -287,6 +294,17 @@ let expand_builtin_va_start_64 r = emit (Pleaq (RAX, linear_addr RSP (Z.of_uint64 reg_save_area))); emit (Pmovq_mr (linear_addr r _16z, RAX)) +let expand_builtin_va_start_win64 r = + if not (is_current_function_variadic ()) then + invalid_arg "Fatal error: va_start used in non-vararg function"; + let num_args = + List.length (get_current_function_args()) in + let ofs = + Int64.(add !current_function_stacksize + (mul 8L (of_int num_args))) in + emit (Pleaq (RAX, linear_addr RSP (Z.of_uint64 ofs))); + emit (Pmovq_mr (linear_addr r _0z, RAX)) + (* FMA operations *) (* vfmadd r1, r2, r3 performs r1 := ri * rj + rk @@ -463,8 +481,8 @@ let expand_builtin_inline name args res = (* Vararg stuff *) | "__builtin_va_start", [BA(IR a)], _ -> assert (a = RDX); - if Archi.ptr64 - then expand_builtin_va_start_64 a + if Archi.win64 then expand_builtin_va_start_win64 a + else if Archi.ptr64 then expand_builtin_va_start_elf64 a else expand_builtin_va_start_32 a (* Synchronization *) | "__builtin_membar", [], _ -> @@ -476,24 +494,66 @@ let expand_builtin_inline name args res = | _ -> raise (Error ("unrecognized builtin " ^ name)) -(* Calls to variadic functions for x86-64: register AL must contain +(* Calls to variadic functions for x86-64 ELF: register AL must contain the number of XMM registers used for parameter passing. To be on - the safe side. do the same if the called function is + the safe side, do the same if the called function is unprototyped. *) -let set_al sg = - if Archi.ptr64 && (sg.sig_cc.cc_vararg || sg.sig_cc.cc_unproto) then begin +let fixup_funcall_elf64 sg = + if sg.sig_cc.cc_vararg || sg.sig_cc.cc_unproto then begin let (ir, fr, ofs) = next_arg_locations 0 0 0 sg.sig_args in emit (Pmovl_ri (RAX, coqint_of_camlint (Int32.of_int fr))) end +(* Calls to variadic functions for x86-64 Windows: + FP arguments passed in FP registers must also be passed in integer + registers. +*) + +let rec copy_fregs_to_iregs args fr ir = + match (ir, fr, args) with + | (i1 :: ir, f1 :: fr, (Tfloat | Tsingle) :: args) -> + emit (Pmovq_rf (i1, f1)); + copy_fregs_to_iregs args fr ir + | (i1 :: ir, f1 :: fr, _ :: args) -> + copy_fregs_to_iregs args fr ir + | _ -> + () + +let fixup_funcall_win64 sg = + if sg.sig_cc.cc_vararg then + copy_fregs_to_iregs sg.sig_args [XMM0; XMM1; XMM2; XMM3] [RCX; RDX; R8; R9] + +let fixup_funcall sg = + if Archi.ptr64 + then if Archi.win64 + then fixup_funcall_win64 sg + else fixup_funcall_elf64 sg + else () + (* Expansion of instructions *) let expand_instruction instr = match instr with | Pallocframe (sz, ofs_ra, ofs_link) -> - if Archi.ptr64 then begin - let (sz, save_regs) = sp_adjustment_64 sz in + if Archi.win64 then begin + let sz = sp_adjustment_win64 sz in + if is_current_function_variadic() then + (* Save parameters passed in registers in reserved stack area *) + emit (Pcall_s (intern_string "__compcert_va_saveregs", + {sig_args = []; sig_res = Tvoid; sig_cc = cc_default})); + (* Allocate frame *) + let sz' = Z.of_uint sz in + emit (Psubl_ri (RSP, sz')); + emit (Pcfi_adjust sz'); + (* Stack chaining *) + let addr1 = linear_addr RSP (Z.of_uint (sz + 8)) in + let addr2 = linear_addr RSP ofs_link in + emit (Pleaq (RAX,addr1)); + emit (Pmovq_mr (addr2, RAX)); + current_function_stacksize := Int64.of_int (sz + 8) + end else if Archi.ptr64 then begin + let (sz, save_regs) = sp_adjustment_elf64 sz in (* Allocate frame *) let sz' = Z.of_uint sz in emit (Psubq_ri (RSP, sz')); @@ -525,15 +585,18 @@ let expand_instruction instr = PrintAsmaux.current_function_stacksize := Int32.of_int sz end | Pfreeframe(sz, ofs_ra, ofs_link) -> - if Archi.ptr64 then begin - let (sz, _) = sp_adjustment_64 sz in + if Archi.win64 then begin + let sz = sp_adjustment_win64 sz in + emit (Paddq_ri (RSP, Z.of_uint sz)) + end else if Archi.ptr64 then begin + let (sz, _) = sp_adjustment_elf64 sz in emit (Paddq_ri (RSP, Z.of_uint sz)) end else begin let sz = sp_adjustment_32 sz in emit (Paddl_ri (RSP, Z.of_uint sz)) end | Pjmp_s(_, sg) | Pjmp_r(_, sg) | Pcall_s(_, sg) | Pcall_r(_, sg) -> - set_al sg; + fixup_funcall sg; emit instr | Pbuiltin (ef,args, res) -> begin diff --git a/x86/CBuiltins.ml b/x86/CBuiltins.ml index 6820c089..a16f3ef7 100644 --- a/x86/CBuiltins.ml +++ b/x86/CBuiltins.ml @@ -19,8 +19,12 @@ open C let (va_list_type, va_list_scalar, size_va_list) = if Archi.ptr64 then - (* Actually a struct passed by reference; equivalent to 3 64-bit words *) - (TArray(TInt(IULong, []), Some 3L, []), false, 3*8) + if Archi.win64 then + (* Just a pointer *) + (TPtr(TVoid [], []), true, 8) + else + (* Actually a struct passed by reference; equivalent to 3 64-bit words *) + (TArray(TInt(IULong, []), Some 3L, []), false, 3*8) else (* Just a pointer *) (TPtr(TVoid [], []), true, 4) diff --git a/x86/ConstpropOp.vp b/x86/ConstpropOp.vp index ada8d54a..dd4b839a 100644 --- a/x86/ConstpropOp.vp +++ b/x86/ConstpropOp.vp @@ -17,11 +17,10 @@ Require Import Coqlib Compopts. Require Import AST Integers Floats. Require Import Op Registers. Require Import ValueDomain ValueAOp. +Require SelectOp. (** * Converting known values to constants *) -Parameter symbol_is_external: ident -> bool. (**r See [SelectOp] *) - Definition Olea_ptr (a: addressing) := if Archi.ptr64 then Oleal a else Olea a. Definition const_for_result (a: aval) : option operation := @@ -31,7 +30,7 @@ Definition const_for_result (a: aval) : option operation := | F n => if Compopts.generate_float_constants tt then Some(Ofloatconst n) else None | FS n => if Compopts.generate_float_constants tt then Some(Osingleconst n) else None | Ptr(Gl id ofs) => - if symbol_is_external id then + if SelectOp.symbol_is_external id then if Ptrofs.eq ofs Ptrofs.zero then Some (Oindirectsymbol id) else None else Some (Olea_ptr (Aglobal id ofs)) diff --git a/x86/ConstpropOpproof.v b/x86/ConstpropOpproof.v index 6d2df9c1..82179fa4 100644 --- a/x86/ConstpropOpproof.v +++ b/x86/ConstpropOpproof.v @@ -107,7 +107,7 @@ Proof. - (* pointer *) destruct p; try discriminate; SimplVM. + (* global *) - destruct (symbol_is_external id). + destruct (SelectOp.symbol_is_external id). * revert H2; predSpec Ptrofs.eq Ptrofs.eq_spec ofs Ptrofs.zero; intros EQ; inv EQ. exists (Genv.symbol_address ge id Ptrofs.zero); auto. * inv H2. exists (Genv.symbol_address ge id ofs); split. diff --git a/x86/Conventions1.v b/x86/Conventions1.v index fdd94239..645aae90 100644 --- a/x86/Conventions1.v +++ b/x86/Conventions1.v @@ -31,40 +31,44 @@ Definition is_callee_save (r: mreg) : bool := match r with | AX | CX | DX => false | BX | BP => true - | SI | DI => negb Archi.ptr64 (**r callee-save in 32 bits but not in 64 bits *) + | SI | DI => negb Archi.ptr64 || Archi.win64 (**r callee-save in ELF 64 bits *) | R8 | R9 | R10 | R11 => false | R12 | R13 | R14 | R15 => true | X0 | X1 | X2 | X3 | X4 | X5 | X6 | X7 => false - | X8 | X9 | X10 | X11 | X12 | X13 | X14 | X15 => false + | X8 | X9 | X10 | X11 | X12 | X13 | X14 | X15 => Archi.win64 | FP0 => false end. Definition int_caller_save_regs := if Archi.ptr64 - then AX :: CX :: DX :: SI :: DI :: R8 :: R9 :: R10 :: R11 :: nil + then if Archi.win64 + then AX :: CX :: DX :: R8 :: R9 :: R10 :: R11 :: nil + else AX :: CX :: DX :: SI :: DI :: R8 :: R9 :: R10 :: R11 :: nil else AX :: CX :: DX :: nil. Definition float_caller_save_regs := if Archi.ptr64 - then X0 :: X1 :: X2 :: X3 :: X4 :: X5 :: X6 :: X7 :: - X8 :: X9 :: X10 :: X11 :: X12 :: X13 :: X14 :: X15 :: nil + then if Archi.win64 + then X0 :: X1 :: X2 :: X3 :: X4 :: X5 :: nil + else X0 :: X1 :: X2 :: X3 :: X4 :: X5 :: X6 :: X7 :: + X8 :: X9 :: X10 :: X11 :: X12 :: X13 :: X14 :: X15 :: nil else X0 :: X1 :: X2 :: X3 :: X4 :: X5 :: X6 :: X7 :: nil. Definition int_callee_save_regs := if Archi.ptr64 - then BX :: BP :: R12 :: R13 :: R14 :: R15 :: nil + then if Archi.win64 + then BX :: SI :: DI :: BP :: R12 :: R13 :: R14 :: R15 :: nil + else BX :: BP :: R12 :: R13 :: R14 :: R15 :: nil else BX :: SI :: DI :: BP :: nil. -Definition float_callee_save_regs : list mreg := nil. +Definition float_callee_save_regs := + if Archi.ptr64 && Archi.win64 + then X6 :: X7 :: X8 :: X9 :: X10 :: X11 :: X12 :: X13 :: X14 :: X15 :: nil + else nil. Definition destroyed_at_call := List.filter (fun r => negb (is_callee_save r)) all_mregs. -Definition dummy_int_reg := AX. (**r Used in [Regalloc]. *) -Definition dummy_float_reg := X0. (**r Used in [Regalloc]. *) - -Definition callee_save_type := mreg_type. - Definition is_float_reg (r: mreg) := match r with | AX | BX | CX | DX | SI | DI | BP @@ -73,6 +77,11 @@ Definition is_float_reg (r: mreg) := | X8 | X9 | X10 | X11 | X12 | X13 | X14 | X15 | FP0 => true end. +Definition dummy_int_reg := AX. (**r Used in [Regalloc]. *) +Definition dummy_float_reg := X0. (**r Used in [Regalloc]. *) + +Definition callee_save_type := mreg_type. + (** * Function calling conventions *) (** The functions in this section determine the locations (machine registers @@ -181,7 +190,7 @@ Fixpoint loc_arguments_32 :: loc_arguments_32 tys (ofs + typesize ty) end. -(** In the x86-64 ABI: +(** In the x86-64 ELF ABI: - The first 6 integer arguments are passed in registers [DI], [SI], [DX], [CX], [R8], [R9]. - The first 8 floating-point arguments are passed in registers [X0] to [X7]. - Extra arguments are passed on the stack, in [Outgoing] slots. @@ -189,26 +198,62 @@ Fixpoint loc_arguments_32 of data is used in a slot. *) -Definition int_param_regs := DI :: SI :: DX :: CX :: R8 :: R9 :: nil. -Definition float_param_regs := X0 :: X1 :: X2 :: X3 :: X4 :: X5 :: X6 :: X7 :: nil. +Definition int_param_regs_elf64 := DI :: SI :: DX :: CX :: R8 :: R9 :: nil. +Definition float_param_regs_elf64 := X0 :: X1 :: X2 :: X3 :: X4 :: X5 :: X6 :: X7 :: nil. -Fixpoint loc_arguments_64 +Fixpoint loc_arguments_elf64 (tyl: list typ) (ir fr ofs: Z) {struct tyl} : list (rpair loc) := match tyl with | nil => nil | (Tint | Tlong | Tany32 | Tany64) as ty :: tys => - match list_nth_z int_param_regs ir with + match list_nth_z int_param_regs_elf64 ir with | None => - One (S Outgoing ofs ty) :: loc_arguments_64 tys ir fr (ofs + 2) + One (S Outgoing ofs ty) :: loc_arguments_elf64 tys ir fr (ofs + 2) | Some ireg => - One (R ireg) :: loc_arguments_64 tys (ir + 1) fr ofs + One (R ireg) :: loc_arguments_elf64 tys (ir + 1) fr ofs end | (Tfloat | Tsingle) as ty :: tys => - match list_nth_z float_param_regs fr with + match list_nth_z float_param_regs_elf64 fr with | None => - One (S Outgoing ofs ty) :: loc_arguments_64 tys ir fr (ofs + 2) + One (S Outgoing ofs ty) :: loc_arguments_elf64 tys ir fr (ofs + 2) | Some freg => - One (R freg) :: loc_arguments_64 tys ir (fr + 1) ofs + One (R freg) :: loc_arguments_elf64 tys ir (fr + 1) ofs + end + end. + +(** In the x86-64 Win64 ABI: +- The first 4 arguments are passed in registers [RCX], [RDX], [R8], and [R9] + (for integer arguments) and [X0] to [X3] (for floating-point arguments). + Each argument "burns" both an integer register and a FP integer. +- The first 8 floating-point arguments are passed in registers [X0] to [X7]. +- Extra arguments are passed on the stack, in [Outgoing] slots. + Consecutive stack slots are separated by 8 bytes, even if only 4 bytes + of data is used in a slot. +- Four 8-byte words are always reserved at the bottom of the outgoing area + so that the callee can use them to save the registers containing the + first four arguments. This is handled in the Stacking phase. +*) + +Definition int_param_regs_win64 := CX :: DX :: R8 :: R9 :: nil. +Definition float_param_regs_win64 := X0 :: X1 :: X2 :: X3 :: nil. + +Fixpoint loc_arguments_win64 + (tyl: list typ) (r ofs: Z) {struct tyl} : list (rpair loc) := + match tyl with + | nil => nil + | (Tint | Tlong | Tany32 | Tany64) as ty :: tys => + match list_nth_z int_param_regs_win64 r with + | None => + One (S Outgoing ofs ty) :: loc_arguments_win64 tys r (ofs + 2) + | Some ireg => + One (R ireg) :: loc_arguments_win64 tys (r + 1) ofs + end + | (Tfloat | Tsingle) as ty :: tys => + match list_nth_z float_param_regs_win64 r with + | None => + One (S Outgoing ofs ty) :: loc_arguments_win64 tys r (ofs + 2) + | Some freg => + One (R freg) :: loc_arguments_win64 tys (r + 1) ofs end end. @@ -217,7 +262,9 @@ Fixpoint loc_arguments_64 Definition loc_arguments (s: signature) : list (rpair loc) := if Archi.ptr64 - then loc_arguments_64 s.(sig_args) 0 0 0 + then if Archi.win64 + then loc_arguments_win64 s.(sig_args) 0 0 + else loc_arguments_elf64 s.(sig_args) 0 0 0 else loc_arguments_32 s.(sig_args) 0. (** Argument locations are either caller-save registers or [Outgoing] @@ -236,9 +283,16 @@ Definition loc_argument_32_charact (ofs: Z) (l: loc) : Prop := | _ => False end. -Definition loc_argument_64_charact (ofs: Z) (l: loc) : Prop := +Definition loc_argument_elf64_charact (ofs: Z) (l: loc) : Prop := match l with - | R r => In r int_param_regs \/ In r float_param_regs + | R r => In r int_param_regs_elf64 \/ In r float_param_regs_elf64 + | S Outgoing ofs' ty => ofs' >= ofs /\ (2 | ofs') + | _ => False + end. + +Definition loc_argument_win64_charact (ofs: Z) (l: loc) : Prop := + match l with + | R r => In r int_param_regs_win64 \/ In r float_param_regs_win64 | S Outgoing ofs' ty => ofs' >= ofs /\ (2 | ofs') | _ => False end. @@ -258,37 +312,75 @@ Proof. * destruct H; split; eapply X; eauto; omega. Qed. -Remark loc_arguments_64_charact: +Remark loc_arguments_elf64_charact: forall tyl ir fr ofs p, - In p (loc_arguments_64 tyl ir fr ofs) -> (2 | ofs) -> forall_rpair (loc_argument_64_charact ofs) p. + In p (loc_arguments_elf64 tyl ir fr ofs) -> (2 | ofs) -> forall_rpair (loc_argument_elf64_charact ofs) p. +Proof. + assert (X: forall ofs1 ofs2 l, loc_argument_elf64_charact ofs2 l -> ofs1 <= ofs2 -> loc_argument_elf64_charact ofs1 l). + { destruct l; simpl; intros; auto. destruct sl; auto. intuition omega. } + assert (Y: forall ofs1 ofs2 p, forall_rpair (loc_argument_elf64_charact ofs2) p -> ofs1 <= ofs2 -> forall_rpair (loc_argument_elf64_charact ofs1) p). + { destruct p; simpl; intuition eauto. } + assert (Z: forall ofs, (2 | ofs) -> (2 | ofs + 2)). + { intros. apply Z.divide_add_r; auto. apply Z.divide_refl. } +Opaque list_nth_z. + induction tyl; simpl loc_arguments_elf64; intros. + elim H. + assert (A: forall ty, In p + match list_nth_z int_param_regs_elf64 ir with + | Some ireg => One (R ireg) :: loc_arguments_elf64 tyl (ir + 1) fr ofs + | None => One (S Outgoing ofs ty) :: loc_arguments_elf64 tyl ir fr (ofs + 2) + end -> + forall_rpair (loc_argument_elf64_charact ofs) p). + { intros. destruct (list_nth_z int_param_regs_elf64 ir) as [r|] eqn:E; destruct H1. + subst. left. eapply list_nth_z_in; eauto. + eapply IHtyl; eauto. + subst. split. omega. assumption. + eapply Y; eauto. omega. } + assert (B: forall ty, In p + match list_nth_z float_param_regs_elf64 fr with + | Some ireg => One (R ireg) :: loc_arguments_elf64 tyl ir (fr + 1) ofs + | None => One (S Outgoing ofs ty) :: loc_arguments_elf64 tyl ir fr (ofs + 2) + end -> + forall_rpair (loc_argument_elf64_charact ofs) p). + { intros. destruct (list_nth_z float_param_regs_elf64 fr) as [r|] eqn:E; destruct H1. + subst. right. eapply list_nth_z_in; eauto. + eapply IHtyl; eauto. + subst. split. omega. assumption. + eapply Y; eauto. omega. } + destruct a; eauto. +Qed. + +Remark loc_arguments_win64_charact: + forall tyl r ofs p, + In p (loc_arguments_win64 tyl r ofs) -> (2 | ofs) -> forall_rpair (loc_argument_win64_charact ofs) p. Proof. - assert (X: forall ofs1 ofs2 l, loc_argument_64_charact ofs2 l -> ofs1 <= ofs2 -> loc_argument_64_charact ofs1 l). + assert (X: forall ofs1 ofs2 l, loc_argument_win64_charact ofs2 l -> ofs1 <= ofs2 -> loc_argument_win64_charact ofs1 l). { destruct l; simpl; intros; auto. destruct sl; auto. intuition omega. } - assert (Y: forall ofs1 ofs2 p, forall_rpair (loc_argument_64_charact ofs2) p -> ofs1 <= ofs2 -> forall_rpair (loc_argument_64_charact ofs1) p). + assert (Y: forall ofs1 ofs2 p, forall_rpair (loc_argument_win64_charact ofs2) p -> ofs1 <= ofs2 -> forall_rpair (loc_argument_win64_charact ofs1) p). { destruct p; simpl; intuition eauto. } assert (Z: forall ofs, (2 | ofs) -> (2 | ofs + 2)). { intros. apply Z.divide_add_r; auto. apply Z.divide_refl. } Opaque list_nth_z. - induction tyl; simpl loc_arguments_64; intros. + induction tyl; simpl loc_arguments_win64; intros. elim H. assert (A: forall ty, In p - match list_nth_z int_param_regs ir with - | Some ireg => One (R ireg) :: loc_arguments_64 tyl (ir + 1) fr ofs - | None => One (S Outgoing ofs ty) :: loc_arguments_64 tyl ir fr (ofs + 2) + match list_nth_z int_param_regs_win64 r with + | Some ireg => One (R ireg) :: loc_arguments_win64 tyl (r + 1) ofs + | None => One (S Outgoing ofs ty) :: loc_arguments_win64 tyl r (ofs + 2) end -> - forall_rpair (loc_argument_64_charact ofs) p). - { intros. destruct (list_nth_z int_param_regs ir) as [r|] eqn:E; destruct H1. + forall_rpair (loc_argument_win64_charact ofs) p). + { intros. destruct (list_nth_z int_param_regs_win64 r) as [r'|] eqn:E; destruct H1. subst. left. eapply list_nth_z_in; eauto. eapply IHtyl; eauto. subst. split. omega. assumption. eapply Y; eauto. omega. } assert (B: forall ty, In p - match list_nth_z float_param_regs fr with - | Some ireg => One (R ireg) :: loc_arguments_64 tyl ir (fr + 1) ofs - | None => One (S Outgoing ofs ty) :: loc_arguments_64 tyl ir fr (ofs + 2) + match list_nth_z float_param_regs_win64 r with + | Some ireg => One (R ireg) :: loc_arguments_win64 tyl (r + 1) ofs + | None => One (S Outgoing ofs ty) :: loc_arguments_win64 tyl r (ofs + 2) end -> - forall_rpair (loc_argument_64_charact ofs) p). - { intros. destruct (list_nth_z float_param_regs fr) as [r|] eqn:E; destruct H1. + forall_rpair (loc_argument_win64_charact ofs) p). + { intros. destruct (list_nth_z float_param_regs_win64 r) as [r'|] eqn:E; destruct H1. subst. right. eapply list_nth_z_in; eauto. eapply IHtyl; eauto. subst. split. omega. assumption. @@ -300,18 +392,30 @@ Lemma loc_arguments_acceptable: forall (s: signature) (p: rpair loc), In p (loc_arguments s) -> forall_rpair loc_argument_acceptable p. Proof. - unfold loc_arguments; intros. destruct Archi.ptr64 eqn:SF. -- (* 64 bits *) - assert (A: forall r, In r int_param_regs -> is_callee_save r = false) by (unfold is_callee_save; rewrite SF; decide_goal). - assert (B: forall r, In r float_param_regs -> is_callee_save r = false) by decide_goal. - assert (X: forall l, loc_argument_64_charact 0 l -> loc_argument_acceptable l). - { unfold loc_argument_64_charact, loc_argument_acceptable. + unfold loc_arguments; intros. destruct Archi.ptr64 eqn:SF; [destruct Archi.win64 eqn:W64|]. +- (* WIN 64 bits *) + assert (A: forall r, In r int_param_regs_win64 -> is_callee_save r = false) by (unfold is_callee_save; rewrite SF; decide_goal). + assert (B: forall r, In r float_param_regs_win64 -> is_callee_save r = false) by (unfold is_callee_save; decide_goal). + assert (X: forall l, loc_argument_win64_charact 0 l -> loc_argument_acceptable l). + { unfold loc_argument_win64_charact, loc_argument_acceptable. destruct l as [r | [] ofs ty]; auto. intros [C|C]; auto. intros [C D]. split; auto. apply Z.divide_trans with 2; auto. exists (2 / typealign ty); destruct ty; reflexivity. } - exploit loc_arguments_64_charact; eauto using Z.divide_0_r. + exploit loc_arguments_win64_charact; eauto using Z.divide_0_r. unfold forall_rpair; destruct p; intuition auto. +- (* ELF 64 bits *) + assert (A: forall r, In r int_param_regs_elf64 -> is_callee_save r = false) by (unfold is_callee_save; rewrite SF, W64; decide_goal). + assert (B: forall r, In r float_param_regs_elf64 -> is_callee_save r = false) by (unfold is_callee_save; rewrite W64; decide_goal). + assert (X: forall l, loc_argument_elf64_charact 0 l -> loc_argument_acceptable l). + { unfold loc_argument_elf64_charact, loc_argument_acceptable. + destruct l as [r | [] ofs ty]; auto. intros [C|C]; auto. + intros [C D]. split; auto. apply Z.divide_trans with 2; auto. + exists (2 / typealign ty); destruct ty; reflexivity. + } + exploit loc_arguments_elf64_charact; eauto using Z.divide_0_r. + unfold forall_rpair; destruct p; intuition auto. + - (* 32 bits *) assert (X: forall l, loc_argument_32_charact 0 l -> loc_argument_acceptable l). { destruct l as [r | [] ofs ty]; simpl; intuition auto. rewrite H2; apply Z.divide_1_l. } @@ -324,7 +428,7 @@ Hint Resolve loc_arguments_acceptable: locs. Lemma loc_arguments_main: loc_arguments signature_main = nil. Proof. - unfold loc_arguments; destruct Archi.ptr64; reflexivity. + unfold loc_arguments; destruct Archi.ptr64; auto; destruct Archi.win64; auto. Qed. (** ** Normalization of function results *) diff --git a/x86/Stacklayout.v b/x86/Stacklayout.v index d375febf..4f68cf26 100644 --- a/x86/Stacklayout.v +++ b/x86/Stacklayout.v @@ -15,11 +15,13 @@ Require Import Coqlib. Require Import AST Memory Separation. Require Import Bounds. +Require Archi. Local Open Scope sep_scope. (** The general shape of activation records is as follows, from bottom (lowest offsets) to top: +- For the Win64 ABI: 32 reserved bytes - Space for outgoing arguments to function calls. - Back link to parent frame - Saved values of integer callee-save registers used by the function. @@ -29,11 +31,11 @@ Local Open Scope sep_scope. - Return address. *) -Definition fe_ofs_arg := 0. +Definition fe_ofs_arg := if Archi.win64 then 32 else 0. Definition make_env (b: bounds) : frame_env := let w := if Archi.ptr64 then 8 else 4 in - let olink := align (4 * b.(bound_outgoing)) w in (* back link *) + let olink := align (fe_ofs_arg + 4 * b.(bound_outgoing)) w in (* back link *) let ocs := olink + w in (* callee-saves *) let ol := align (size_callee_save_area b ocs) 8 in (* locals *) let ostkdata := align (ol + 4 * b.(bound_local)) 8 in (* stack data *) @@ -61,7 +63,7 @@ Proof. Local Opaque Z.add Z.mul sepconj range. intros; simpl. set (w := if Archi.ptr64 then 8 else 4). - set (olink := align (4 * b.(bound_outgoing)) w). + set (olink := align (fe_ofs_arg + 4 * b.(bound_outgoing)) w). set (ocs := olink + w). set (ol := align (size_callee_save_area b ocs) 8). set (ostkdata := align (ol + 4 * b.(bound_local)) 8). @@ -69,8 +71,9 @@ Local Opaque Z.add Z.mul sepconj range. replace (size_chunk Mptr) with w by (rewrite size_chunk_Mptr; auto). assert (0 < w) by (unfold w; destruct Archi.ptr64; omega). generalize b.(bound_local_pos) b.(bound_outgoing_pos) b.(bound_stack_data_pos); intros. + assert (0 <= fe_ofs_arg) by (unfold fe_ofs_arg; destruct Archi.win64; omega). assert (0 <= 4 * b.(bound_outgoing)) by omega. - assert (4 * b.(bound_outgoing) <= olink) by (apply align_le; omega). + assert (fe_ofs_arg + 4 * b.(bound_outgoing) <= olink) by (apply align_le; omega). assert (olink + w <= ocs) by (unfold ocs; omega). assert (ocs <= size_callee_save_area b ocs) by (apply size_callee_save_area_incr). assert (size_callee_save_area b ocs <= ol) by (apply align_le; omega). @@ -87,7 +90,7 @@ Local Opaque Z.add Z.mul sepconj range. rewrite sep_swap45. rewrite sep_swap34. (* Apply range_split and range_split2 repeatedly *) - unfold fe_ofs_arg. + apply range_drop_left with 0. omega. apply range_split_2. fold olink. omega. omega. apply range_split. omega. apply range_split_2. fold ol. omega. omega. @@ -105,15 +108,16 @@ Lemma frame_env_range: Proof. intros; simpl. set (w := if Archi.ptr64 then 8 else 4). - set (olink := align (4 * b.(bound_outgoing)) w). + set (olink := align (fe_ofs_arg + 4 * b.(bound_outgoing)) w). set (ocs := olink + w). set (ol := align (size_callee_save_area b ocs) 8). set (ostkdata := align (ol + 4 * b.(bound_local)) 8). set (oretaddr := align (ostkdata + b.(bound_stack_data)) w). assert (0 < w) by (unfold w; destruct Archi.ptr64; omega). generalize b.(bound_local_pos) b.(bound_outgoing_pos) b.(bound_stack_data_pos); intros. + assert (0 <= fe_ofs_arg) by (unfold fe_ofs_arg; destruct Archi.win64; omega). assert (0 <= 4 * b.(bound_outgoing)) by omega. - assert (4 * b.(bound_outgoing) <= olink) by (apply align_le; omega). + assert (fe_ofs_arg + 4 * b.(bound_outgoing) <= olink) by (apply align_le; omega). assert (olink + w <= ocs) by (unfold ocs; omega). assert (ocs <= size_callee_save_area b ocs) by (apply size_callee_save_area_incr). assert (size_callee_save_area b ocs <= ol) by (apply align_le; omega). @@ -133,14 +137,14 @@ Lemma frame_env_aligned: Proof. intros; simpl. set (w := if Archi.ptr64 then 8 else 4). - set (olink := align (4 * b.(bound_outgoing)) w). + set (olink := align (fe_ofs_arg + 4 * b.(bound_outgoing)) w). set (ocs := olink + w). set (ol := align (size_callee_save_area b ocs) 8). set (ostkdata := align (ol + 4 * b.(bound_local)) 8). set (oretaddr := align (ostkdata + b.(bound_stack_data)) w). assert (0 < w) by (unfold w; destruct Archi.ptr64; omega). replace (align_chunk Mptr) with w by (rewrite align_chunk_Mptr; auto). - split. apply Z.divide_0_r. + split. exists (fe_ofs_arg / 8). unfold fe_ofs_arg; destruct Archi.win64; reflexivity. split. apply align_divides; omega. split. apply align_divides; omega. split. apply align_divides; omega. diff --git a/x86/TargetPrinter.ml b/x86/TargetPrinter.ml index f0a54506..481b09b9 100644 --- a/x86/TargetPrinter.ml +++ b/x86/TargetPrinter.ml @@ -239,8 +239,11 @@ module MacOS_System : SYSTEM = module Cygwin_System : SYSTEM = struct + let symbol_prefix = + if Archi.ptr64 then "" else "_" + let raw_symbol oc s = - fprintf oc "_%s" s + fprintf oc "%s%s" symbol_prefix s let symbol oc symb = raw_symbol oc (extern_atom symb) @@ -268,19 +271,39 @@ module Cygwin_System : SYSTEM = | Section_debug_str-> assert false (* Should not be used *) | Section_ais_annotation -> assert false (* Not supported for coff binaries *) - let stack_alignment = 8 (* minimum is 4, 8 is better for perfs *) + let stack_alignment = 8 + (* minimum is 4 for 32 bits, 8 for 64 bits; 8 is better for perfs *) let print_align oc n = fprintf oc " .balign %d\n" n + let indirect_symbols : StringSet.t ref = ref StringSet.empty + let print_mov_rs oc rd id = - fprintf oc " movl $%a, %a\n" symbol id ireg rd + if Archi.ptr64 then begin + let s = extern_atom id in + indirect_symbols := StringSet.add s !indirect_symbols; + fprintf oc " movq .refptr.%s(%%rip), %a\n" s ireg rd + end else begin + fprintf oc " movl $%a, %a\n" symbol id ireg rd + end let print_fun_info _ _ = () let print_var_info _ _ = () - let print_epilogue _ = () + let declare_indirect_symbol oc s = + fprintf oc " .section .rdata$.refptr.%s, \"dr\"\n" s; + fprintf oc " .globl .refptr.%s\n" s; + fprintf oc " .linkonce discard\n"; + fprintf oc ".refptr.%s:\n" s; + fprintf oc " .quad %s\n" s + + let print_epilogue oc = + if Archi.ptr64 then begin + StringSet.iter (declare_indirect_symbol oc) !indirect_symbols; + indirect_symbols := StringSet.empty + end let print_comm_decl oc name sz al = fprintf oc " .comm %a, %s, %d\n" @@ -288,7 +311,8 @@ module Cygwin_System : SYSTEM = let print_lcomm_decl oc name sz al = fprintf oc " .lcomm %a, %s, %d\n" - symbol name (Z.to_string sz) (log2 al) + symbol name (Z.to_string sz) + (if Archi.ptr64 then al else log2 al) end @@ -769,6 +793,8 @@ module Target(System: SYSTEM):TARGET = fprintf oc " minsd %a, %a\n" freg a1 freg res | Pmovb_rm (rd,a) -> fprintf oc " movb %a, %a\n" addressing a ireg8 rd + | Pmovq_rf (rd, r1) -> + fprintf oc " movq %a, %a\n" freg r1 ireg64 rd | Pmovsq_mr(a, rs) -> fprintf oc " movq %a, %a\n" freg rs addressing a | Pmovsq_rm(rd, a) -> diff --git a/x86/extractionMachdep.v b/x86/extractionMachdep.v index a29553e8..20c6a521 100644 --- a/x86/extractionMachdep.v +++ b/x86/extractionMachdep.v @@ -15,15 +15,19 @@ (* Additional extraction directives specific to the x86-64 port *) -Require SelectOp ConstpropOp. +Require Archi SelectOp. -(* SelectOp *) - -Extract Constant SelectOp.symbol_is_external => - "fun id -> Configuration.system = ""macosx"" && C2C.atom_is_extern id". +(* Archi *) -(* ConstpropOp *) +Extract Constant Archi.win64 => + "match Configuration.system with + | ""cygwin"" when ptr64 -> true + | _ -> false". -Extract Constant ConstpropOp.symbol_is_external => - "fun id -> Configuration.system = ""macosx"" && C2C.atom_is_extern id". +(* SelectOp *) +Extract Constant SelectOp.symbol_is_external => + "match Configuration.system with + | ""macosx"" -> C2C.atom_is_extern + | ""cygwin"" when Archi.ptr64 -> C2C.atom_is_extern + | _ -> (fun _ -> false)". diff --git a/x86_32/Archi.v b/x86_32/Archi.v index b7e8e586..bbc04950 100644 --- a/x86_32/Archi.v +++ b/x86_32/Archi.v @@ -58,8 +58,12 @@ Definition fma_invalid_mul_is_nan := false. Definition float_of_single_preserves_sNaN := false. +(** Which ABI to use. *) +Parameter win64: bool. (* Always false in 32 bits *) + Global Opaque ptr64 big_endian splitlong default_nan_64 choose_nan_64 default_nan_32 choose_nan_32 fma_order fma_invalid_mul_is_nan float_of_single_preserves_sNaN. + diff --git a/x86_64/Archi.v b/x86_64/Archi.v index 6dc0044f..0e027c0f 100644 --- a/x86_64/Archi.v +++ b/x86_64/Archi.v @@ -58,6 +58,9 @@ Definition fma_invalid_mul_is_nan := false. Definition float_of_single_preserves_sNaN := false. +(** Which ABI to use. *) +Parameter win64: bool. + Global Opaque ptr64 big_endian splitlong default_nan_64 choose_nan_64 default_nan_32 choose_nan_32 -- cgit From 600803caeeaeae889f0b3020423402bf542f022b Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 12 Oct 2020 16:34:56 +0200 Subject: Remove -version-file option It is specific to AbsInt's commercial version of CompCert. --- driver/CommonOptions.ml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/driver/CommonOptions.ml b/driver/CommonOptions.ml index cbc04a44..e8a6941c 100644 --- a/driver/CommonOptions.ml +++ b/driver/CommonOptions.ml @@ -25,26 +25,9 @@ let version_string tool_name = let print_version_and_exit tool_name () = Printf.printf "%s" (version_string tool_name); exit 0 -let version_file_string tool_name = - if Version.buildnr <> "" && Version.tag <> "" then - Printf.sprintf "This is CompCert %s\nVersion: %s\nBuild: %s\nTag: %s\nBranch: %s\n" - tool_name Version.version Version.buildnr Version.tag Version.branch - else - Printf.sprintf "The CompCert %s,\nversion %s\n" tool_name Version.version - -(* Print the version string to a file and exit the program *) -let print_version_file_and_exit tool_name file = - let oc = open_out_bin file in - output_string oc (version_file_string tool_name); - close_out_noerr oc; - exit 0 - let version_options tool_name = [ Exact "-version", Unit (print_version_and_exit tool_name); - Exact "--version", Unit (print_version_and_exit tool_name); - Exact "-version-file", String (print_version_file_and_exit tool_name); - Exact "--version-file", String (print_version_file_and_exit tool_name); - ] + Exact "--version", Unit (print_version_and_exit tool_name) ] (* Language support options *) @@ -105,4 +88,4 @@ let general_options = Exact "-target", Ignore;(* Ignore option since it is already handled *) Exact "-v", Set option_v; Exact "-stdlib", String(fun s -> stdlib_path := s); - Exact "-timings", Set option_timings;] + Exact "-timings", Set option_timings ] -- cgit From 6aeb6455cc52172fbb78999b17503d9a66ce7bfb Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 12 Oct 2020 16:36:03 +0200 Subject: Add `string_of_ident` conversion This is the left inverse of `ident_to_string`. Closes: #372 --- exportclight/Clightdefs.v | 110 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/exportclight/Clightdefs.v b/exportclight/Clightdefs.v index c2b38a92..8af920df 100644 --- a/exportclight/Clightdefs.v +++ b/exportclight/Clightdefs.v @@ -179,3 +179,113 @@ Ltac ident_of_string s := Notation "$ s" := (ltac:(ident_of_string s)) (at level 1, only parsing) : string_scope. + +(** The inverse conversion, from encoded strings to strings *) + +Section DECODE_BITS. + +Variable rec: positive -> string. + +Fixpoint decode_n_bits (n: nat) (l: list bool) (p: positive) : string := + match n with + | O => + match l with + | b7 :: b6 :: b5 :: b4 :: b3 :: b2 :: b1 :: b0 :: _ => + String (Ascii b7 b6 b5 b4 b3 b2 b1 b0) (rec p) + | _ => EmptyString + end + | S n => + match p with + | xO q => decode_n_bits n (false :: l) q + | xI q => decode_n_bits n (true :: l) q + | xH => EmptyString + end + end. + +Definition decode_8_bits := Eval compute in (decode_n_bits 8%nat nil). + +End DECODE_BITS. + +Fixpoint string_of_ident (p: positive) : string := + match p with + | xO (xO (xO (xO (xO (xO p))))) => String "0"%char (string_of_ident p) + | xI (xO (xO (xO (xO (xO p))))) => String "1"%char (string_of_ident p) + | xO (xI (xO (xO (xO (xO p))))) => String "2"%char (string_of_ident p) + | xI (xI (xO (xO (xO (xO p))))) => String "3"%char (string_of_ident p) + | xO (xO (xI (xO (xO (xO p))))) => String "4"%char (string_of_ident p) + | xI (xO (xI (xO (xO (xO p))))) => String "5"%char (string_of_ident p) + | xO (xI (xI (xO (xO (xO p))))) => String "6"%char (string_of_ident p) + | xI (xI (xI (xO (xO (xO p))))) => String "7"%char (string_of_ident p) + | xO (xO (xO (xI (xO (xO p))))) => String "8"%char (string_of_ident p) + | xI (xO (xO (xI (xO (xO p))))) => String "9"%char (string_of_ident p) + | xO (xI (xO (xI (xO (xO p))))) => String "a"%char (string_of_ident p) + | xI (xI (xO (xI (xO (xO p))))) => String "b"%char (string_of_ident p) + | xO (xO (xI (xI (xO (xO p))))) => String "c"%char (string_of_ident p) + | xI (xO (xI (xI (xO (xO p))))) => String "d"%char (string_of_ident p) + | xO (xI (xI (xI (xO (xO p))))) => String "e"%char (string_of_ident p) + | xI (xI (xI (xI (xO (xO p))))) => String "f"%char (string_of_ident p) + | xO (xO (xO (xO (xI (xO p))))) => String "g"%char (string_of_ident p) + | xI (xO (xO (xO (xI (xO p))))) => String "h"%char (string_of_ident p) + | xO (xI (xO (xO (xI (xO p))))) => String "i"%char (string_of_ident p) + | xI (xI (xO (xO (xI (xO p))))) => String "j"%char (string_of_ident p) + | xO (xO (xI (xO (xI (xO p))))) => String "k"%char (string_of_ident p) + | xI (xO (xI (xO (xI (xO p))))) => String "l"%char (string_of_ident p) + | xO (xI (xI (xO (xI (xO p))))) => String "m"%char (string_of_ident p) + | xI (xI (xI (xO (xI (xO p))))) => String "n"%char (string_of_ident p) + | xO (xO (xO (xI (xI (xO p))))) => String "o"%char (string_of_ident p) + | xI (xO (xO (xI (xI (xO p))))) => String "p"%char (string_of_ident p) + | xO (xI (xO (xI (xI (xO p))))) => String "q"%char (string_of_ident p) + | xI (xI (xO (xI (xI (xO p))))) => String "r"%char (string_of_ident p) + | xO (xO (xI (xI (xI (xO p))))) => String "s"%char (string_of_ident p) + | xI (xO (xI (xI (xI (xO p))))) => String "t"%char (string_of_ident p) + | xO (xI (xI (xI (xI (xO p))))) => String "u"%char (string_of_ident p) + | xI (xI (xI (xI (xI (xO p))))) => String "v"%char (string_of_ident p) + | xO (xO (xO (xO (xO (xI p))))) => String "w"%char (string_of_ident p) + | xI (xO (xO (xO (xO (xI p))))) => String "x"%char (string_of_ident p) + | xO (xI (xO (xO (xO (xI p))))) => String "y"%char (string_of_ident p) + | xI (xI (xO (xO (xO (xI p))))) => String "z"%char (string_of_ident p) + | xO (xO (xI (xO (xO (xI p))))) => String "A"%char (string_of_ident p) + | xI (xO (xI (xO (xO (xI p))))) => String "B"%char (string_of_ident p) + | xO (xI (xI (xO (xO (xI p))))) => String "C"%char (string_of_ident p) + | xI (xI (xI (xO (xO (xI p))))) => String "D"%char (string_of_ident p) + | xO (xO (xO (xI (xO (xI p))))) => String "E"%char (string_of_ident p) + | xI (xO (xO (xI (xO (xI p))))) => String "F"%char (string_of_ident p) + | xO (xI (xO (xI (xO (xI p))))) => String "G"%char (string_of_ident p) + | xI (xI (xO (xI (xO (xI p))))) => String "H"%char (string_of_ident p) + | xO (xO (xI (xI (xO (xI p))))) => String "I"%char (string_of_ident p) + | xI (xO (xI (xI (xO (xI p))))) => String "J"%char (string_of_ident p) + | xO (xI (xI (xI (xO (xI p))))) => String "K"%char (string_of_ident p) + | xI (xI (xI (xI (xO (xI p))))) => String "L"%char (string_of_ident p) + | xO (xO (xO (xO (xI (xI p))))) => String "M"%char (string_of_ident p) + | xI (xO (xO (xO (xI (xI p))))) => String "N"%char (string_of_ident p) + | xO (xI (xO (xO (xI (xI p))))) => String "O"%char (string_of_ident p) + | xI (xI (xO (xO (xI (xI p))))) => String "P"%char (string_of_ident p) + | xO (xO (xI (xO (xI (xI p))))) => String "Q"%char (string_of_ident p) + | xI (xO (xI (xO (xI (xI p))))) => String "R"%char (string_of_ident p) + | xO (xI (xI (xO (xI (xI p))))) => String "S"%char (string_of_ident p) + | xI (xI (xI (xO (xI (xI p))))) => String "T"%char (string_of_ident p) + | xO (xO (xO (xI (xI (xI p))))) => String "U"%char (string_of_ident p) + | xI (xO (xO (xI (xI (xI p))))) => String "V"%char (string_of_ident p) + | xO (xI (xO (xI (xI (xI p))))) => String "W"%char (string_of_ident p) + | xI (xI (xO (xI (xI (xI p))))) => String "X"%char (string_of_ident p) + | xO (xO (xI (xI (xI (xI p))))) => String "Y"%char (string_of_ident p) + | xI (xO (xI (xI (xI (xI p))))) => String "Z"%char (string_of_ident p) + | xO (xI (xI (xI (xI (xI p))))) => String "_"%char (string_of_ident p) + | xI (xI (xI (xI (xI (xI p))))) => decode_8_bits string_of_ident p + | _ => EmptyString + end. + +Lemma string_of_ident_of_string: + forall s, string_of_ident (ident_of_string s) = s. +Proof. + induction s as [ | c s]; simpl. +- auto. +- rewrite <- IHs at 2. destruct c as [[] [] [] [] [] [] [] []]; reflexivity. +Qed. + +Corollary ident_of_string_injective: + forall s1 s2, ident_of_string s1 = ident_of_string s2 -> s1 = s2. +Proof. + intros. rewrite <- (string_of_ident_of_string s1), <- (string_of_ident_of_string s2). + congruence. +Qed. -- cgit From b1b853a2e9f7f2143fedd58772a702bc9c6a8ba1 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 30 Oct 2020 18:32:04 +0100 Subject: Add -main option to specify entrypoint function in interpreter mode (#374) When running unit tests with the CompCert reference interpreter, it's nice to be able to start execution at a given test function instead of having to write a main function. This PR adds a -main command-line option to give the name of the entry point function. The default is still main. Frama-C has a similar option. The function specified with -main is called with no arguments. If its return type is int, its return value is the exit status of the program. Otherwise, its return value is ignored and the program exits with status 0. --- cfrontend/C2C.ml | 2 +- driver/Clflags.ml | 1 + driver/Driver.ml | 4 +++- driver/Interp.ml | 55 +++++++++++++++++++++++++++++++++++++------------------ 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index 2386eed9..ef028255 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -1495,7 +1495,7 @@ let convertProgram p = let p' = { prog_defs = gl2; prog_public = public_globals gl2; - prog_main = intern_string "main"; + prog_main = intern_string !Clflags.main_function_name; prog_types = typs; prog_comp_env = ce } in Diagnostics.check_errors (); diff --git a/driver/Clflags.ml b/driver/Clflags.ml index 2db9399f..80883372 100644 --- a/driver/Clflags.ml +++ b/driver/Clflags.ml @@ -67,3 +67,4 @@ let option_small_const = ref (!option_small_data) let option_timings = ref false let stdlib_path = ref Configuration.stdlib_path let use_standard_headers = ref Configuration.has_standard_headers +let main_function_name = ref "main" diff --git a/driver/Driver.ml b/driver/Driver.ml index 66cfeaa7..043e43c1 100644 --- a/driver/Driver.ml +++ b/driver/Driver.ml @@ -233,6 +233,7 @@ Code generation options: (use -fno- to turn off -f) -trace Have the interpreter produce a detailed trace of reductions -random Randomize execution order -all Simulate all possible execution orders + -main Start executing at function instead of main() |} let print_usage_and_exit () = @@ -355,7 +356,8 @@ let cmdline_actions = Exact "-quiet", Unit (fun () -> Interp.trace := 0); Exact "-trace", Unit (fun () -> Interp.trace := 2); Exact "-random", Unit (fun () -> Interp.mode := Interp.Random); - Exact "-all", Unit (fun () -> Interp.mode := Interp.All) + Exact "-all", Unit (fun () -> Interp.mode := Interp.All); + Exact "-main", String (fun s -> main_function_name := s) ] (* Optimization options *) (* -f options: come in -f and -fno- variants *) diff --git a/driver/Interp.ml b/driver/Interp.ml index d4286779..6c83e819 100644 --- a/driver/Interp.ml +++ b/driver/Interp.ml @@ -587,41 +587,60 @@ let world_program prog = (* Massaging the program to get a suitable "main" function *) -let change_main_function p old_main old_main_ty = - let old_main = Evalof(Evar(old_main, old_main_ty), old_main_ty) in +let change_main_function p new_main_fn = + let new_main_id = intern_string "%main%" in + { p with + Ctypes.prog_main = new_main_id; + Ctypes.prog_defs = + (new_main_id, Gfun(Internal new_main_fn)) :: p.Ctypes.prog_defs } + +let call_main3_function main_id main_ty = + let main_var = Evalof(Evar(main_id, main_ty), main_ty) in let arg1 = Eval(Vint(coqint_of_camlint 0l), type_int32s) in let arg2 = arg1 in let body = - Sreturn(Some(Ecall(old_main, Econs(arg1, Econs(arg2, Enil)), type_int32s))) in - let new_main_fn = - { fn_return = type_int32s; fn_callconv = cc_default; - fn_params = []; fn_vars = []; fn_body = body } in - let new_main_id = intern_string "___main" in - { prog_main = new_main_id; - Ctypes.prog_defs = (new_main_id, Gfun(Ctypes.Internal new_main_fn)) :: p.Ctypes.prog_defs; - Ctypes.prog_public = p.Ctypes.prog_public; - prog_types = p.prog_types; - prog_comp_env = p.prog_comp_env } + Sreturn(Some(Ecall(main_var, Econs(arg1, Econs(arg2, Enil)), type_int32s))) + in + { fn_return = type_int32s; fn_callconv = cc_default; + fn_params = []; fn_vars = []; fn_body = body } + +let call_other_main_function main_id main_ty main_ty_res = + let main_var = Evalof(Evar(main_id, main_ty), main_ty) in + let body = + Ssequence(Sdo(Ecall(main_var, Enil, main_ty_res)), + Sreturn(Some(Eval(Vint(coqint_of_camlint 0l), type_int32s)))) in + { fn_return = type_int32s; fn_callconv = cc_default; + fn_params = []; fn_vars = []; fn_body = body } let rec find_main_function name = function | [] -> None - | (id, Gfun fd) :: gdl -> if id = name then Some fd else find_main_function name gdl - | (id, Gvar v) :: gdl -> find_main_function name gdl + | (id, Gfun fd) :: gdl -> + if id = name then Some fd else find_main_function name gdl + | (id, Gvar v) :: gdl -> + find_main_function name gdl let fixup_main p = match find_main_function p.Ctypes.prog_main p.Ctypes.prog_defs with | None -> - fprintf err_formatter "ERROR: no main() function@."; + fprintf err_formatter "ERROR: no entry function %s()@." + (extern_atom p.Ctypes.prog_main); None | Some main_fd -> match type_of_fundef main_fd with | Tfunction(Tnil, Ctypes.Tint(I32, Signed, _), _) -> Some p - | Tfunction(Tcons(Ctypes.Tint _, Tcons(Tpointer(Tpointer(Ctypes.Tint(I8,_,_),_),_), Tnil)), + | Tfunction(Tcons(Ctypes.Tint _, + Tcons(Tpointer(Tpointer(Ctypes.Tint(I8,_,_),_),_), Tnil)), Ctypes.Tint _, _) as ty -> - Some (change_main_function p p.Ctypes.prog_main ty) + Some (change_main_function p + (call_main3_function p.Ctypes.prog_main ty)) + | Tfunction(Tnil, ty_res, _) as ty -> + Some (change_main_function p + (call_other_main_function p.Ctypes.prog_main ty ty_res)) | _ -> - fprintf err_formatter "ERROR: wrong type for main() function@."; + fprintf err_formatter + "ERROR: wrong type for entry function %s()@." + (extern_atom p.Ctypes.prog_main); None (* Execution of a whole program *) -- cgit From c3c7d3a417b37bf7268562c20a27916ae0c51adf Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sun, 1 Nov 2020 13:56:34 +0100 Subject: Better "make clean" --- test/clightgen/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/clightgen/Makefile b/test/clightgen/Makefile index 22c434b7..f0e9d961 100644 --- a/test/clightgen/Makefile +++ b/test/clightgen/Makefile @@ -53,4 +53,4 @@ test: .SECONDARY: $(SRC:.c=.v) clean: - rm -f *.v *.vo .*.aux + rm -f *.v *.vo* .*.aux -- cgit From acaabc6c481cc70e5597ccb74052a7f6d330b0f1 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 29 Oct 2020 18:10:16 +0100 Subject: Added implementation for fmin/fmax for aarch64. The two built-in function map to the fmax and fmin instruction. Bug 30035 --- aarch64/Asm.v | 4 ++++ aarch64/Asmexpand.ml | 4 ++++ aarch64/TargetPrinter.ml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/aarch64/Asm.v b/aarch64/Asm.v index 79232783..5ac577b1 100644 --- a/aarch64/Asm.v +++ b/aarch64/Asm.v @@ -283,6 +283,8 @@ Inductive instruction: Type := | Pfmsub (sz: fsize) (rd r1 r2 r3: freg) (**r [rd = r3 - r1 * r2] *) | Pfnmadd (sz: fsize) (rd r1 r2 r3: freg) (**r [rd = - r3 - r1 * r2] *) | Pfnmsub (sz: fsize) (rd r1 r2 r3: freg) (**r [rd = - r3 + r1 * r2] *) + | Pfmax (sz: fsize) (rd r1 r2: freg) (**r maximum *) + | Pfmin (sz: fsize) (rd r1 r2: freg) (**r minimum *) (** Floating-point comparison *) | Pfcmp (sz: fsize) (r1 r2: freg) (**r compare [r1] and [r2] *) | Pfcmp0 (sz: fsize) (r1: freg) (**r compare [r1] and [+0.0] *) @@ -1114,6 +1116,8 @@ Definition exec_instr (f: function) (i: instruction) (rs: regset) (m: mem) : out | Pfmsub _ _ _ _ _ | Pfnmadd _ _ _ _ _ | Pfnmsub _ _ _ _ _ + | Pfmax _ _ _ _ + | Pfmin _ _ _ _ | Pnop | Pcfi_adjust _ | Pcfi_rel_offset _ => diff --git a/aarch64/Asmexpand.ml b/aarch64/Asmexpand.ml index ea2ee703..1ba754dd 100644 --- a/aarch64/Asmexpand.ml +++ b/aarch64/Asmexpand.ml @@ -363,6 +363,10 @@ let expand_builtin_inline name args res = emit (Pfnmadd(D, res, a1, a2, a3)) | "__builtin_fnmsub", [BA(FR a1); BA(FR a2); BA(FR a3)], BR(FR res) -> emit (Pfnmsub(D, res, a1, a2, a3)) + | "__builtin_fmax", [BA (FR a1); BA (FR a2)], BR (FR res) -> + emit (Pfmax (D, res, a1, a2)) + | "__builtin_fmin", [BA (FR a1); BA (FR a2)], BR (FR res) -> + emit (Pfmin (D, res, a1, a2)) (* Vararg *) | "__builtin_va_start", [BA(IR a)], _ -> expand_builtin_va_start a diff --git a/aarch64/TargetPrinter.ml b/aarch64/TargetPrinter.ml index fec05cc6..78b9eb2a 100644 --- a/aarch64/TargetPrinter.ml +++ b/aarch64/TargetPrinter.ml @@ -467,6 +467,10 @@ module Target : TARGET = fprintf oc " fnmadd %a, %a, %a, %a\n" freg (sz, rd) freg (sz, r1) freg (sz, r2) freg (sz, r3) | Pfnmsub(sz, rd, r1, r2, r3) -> fprintf oc " fnmsub %a, %a, %a, %a\n" freg (sz, rd) freg (sz, r1) freg (sz, r2) freg (sz, r3) + | Pfmax (sz, rd, r1, r2) -> + fprintf oc " fmax %a, %a, %a\n" freg (sz, rd) freg (sz, r1) freg (sz, r2) + | Pfmin (sz, rd, r1, r2) -> + fprintf oc " fmin %a, %a, %a\n" freg (sz, rd) freg (sz, r1) freg (sz, r2) (* Floating-point comparison *) | Pfcmp(sz, r1, r2) -> fprintf oc " fcmp %a, %a\n" freg (sz, r1) freg (sz, r2) -- cgit From 4011a085abee25df19c6e7659f2168ef17c7c344 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 29 Oct 2020 18:16:17 +0100 Subject: Added missing printer for PowerPC 64 bit comparison. These comparisons are supported in the hybrid 64 bit mode. Bug 30035 --- powerpc/PrintOp.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/powerpc/PrintOp.ml b/powerpc/PrintOp.ml index 8d7f17ab..77791827 100644 --- a/powerpc/PrintOp.ml +++ b/powerpc/PrintOp.ml @@ -42,6 +42,14 @@ let print_condition reg pp = function fprintf pp "%a & 0x%lx == 0" reg r1 (camlint_of_coqint n) | (Cmasknotzero n, [r1]) -> fprintf pp "%a & 0x%lx != 0" reg r1 (camlint_of_coqint n) + | (Ccompl c, [r1;r2]) -> + fprintf pp "%a %sls %a" reg r1 (comparison_name c) reg r2 + | (Ccomplu c, [r1;r2]) -> + fprintf pp "%a %slu %a" reg r1 (comparison_name c) reg r2 + | (Ccomplimm(c, n), [r1]) -> + fprintf pp "%a %sls %Ld" reg r1 (comparison_name c) (camlint64_of_coqint n) + | (Ccompluimm(c, n), [r1]) -> + fprintf pp "%a %slu %Ld" reg r1 (comparison_name c) (camlint64_of_coqint n) | _ -> fprintf pp "" -- cgit From 0aeff47ea220a16fec90bcad05e4b79b838a69c9 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 29 Oct 2020 18:16:59 +0100 Subject: Added semantics for the PowerPC sel and mulh built-ins The semantics of the various selection functions are defined analogously to the ones from the type generic sel function. The semantics for the various high word multiplication functions is defined using the Integer functions. Bug 30035 --- powerpc/Builtins1.v | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/powerpc/Builtins1.v b/powerpc/Builtins1.v index 53c83d7e..9d7aadd9 100644 --- a/powerpc/Builtins1.v +++ b/powerpc/Builtins1.v @@ -19,15 +19,55 @@ Require Import String Coqlib. Require Import AST Integers Floats Values. Require Import Builtins0. -Inductive platform_builtin : Type := . +Inductive platform_builtin : Type := + | BI_isel + | BI_uisel + | BI_isel64 + | BI_uisel64 + | BI_bsel + | BI_mulhw + | BI_mulhwu + | BI_mulhd + | BI_mulhdu. Local Open Scope string_scope. Definition platform_builtin_table : list (string * platform_builtin) := - nil. + ("__builtin_isel", BI_isel) + :: ("__builtin_uisel", BI_uisel) + :: ("__builtin_isel64", BI_isel64) + :: ("__builtin_uisel64", BI_uisel64) + :: ("__builtin_bsel", BI_bsel) + :: ("__builtin_mulhw", BI_mulhw) + :: ("__builtin_mulhwu", BI_mulhwu) + :: ("__builtin_mulhd", BI_mulhd) + :: ("__builtin_mulhdu", BI_mulhdu) + :: nil. Definition platform_builtin_sig (b: platform_builtin) : signature := - match b with end. + match b with + | BI_isel | BI_uisel | BI_bsel => + mksignature (Tint :: Tint :: Tint :: nil) Tint cc_default + | BI_isel64 | BI_uisel64 => + mksignature (Tint :: Tlong :: Tlong :: nil) Tlong cc_default + | BI_mulhw | BI_mulhwu => + mksignature (Tint :: Tint :: nil) Tint cc_default + | BI_mulhd | BI_mulhdu => + mksignature (Tlong :: Tlong :: nil) Tlong cc_default + end. Definition platform_builtin_sem (b: platform_builtin) : builtin_sem (sig_res (platform_builtin_sig b)) := - match b with end. + match b with + | BI_isel | BI_uisel | BI_bsel => + mkbuiltin_n3t Tint Tint Tint Tint (fun c n1 n2 => if Int.eq c Int.zero then n2 else n1) + | BI_isel64 | BI_uisel64 => + mkbuiltin_n3t Tint Tlong Tlong Tlong (fun c n1 n2 => if Int.eq c Int.zero then n2 else n1) + | BI_mulhw => + mkbuiltin_n2t Tint Tint Tint Int.mulhs + | BI_mulhwu => + mkbuiltin_n2t Tint Tint Tint Int.mulhu + | BI_mulhd => + mkbuiltin_n2t Tlong Tlong Tlong Int64.mulhs + | BI_mulhdu => + mkbuiltin_n2t Tlong Tlong Tlong Int64.mulhu + end. -- cgit From 64f650c6fc3ea8dae188342166e5c899d2fc5b77 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sun, 8 Nov 2020 09:51:46 +0100 Subject: Update Changes --- Changelog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Changelog b/Changelog index 8cf4e548..8151362c 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,51 @@ +New features: +- Support `_Static_assert` from ISO C11. +- Support `__builtin_constant_p` from GCC and Clang. +- New port: x86 64 bits Windows with the Cygwin 64 environment. + (configure with target `x86_64-cygwin`). +- The following built-in functions are now available for all ports: + `__builtin_sqrt`, `__builtin_fabsf`, and all variants of + `__builtin_clz` and `__builtin_ctz`. +- Added `__builtin_fmin` and `__builtin_fmax` for AArch64. + +Removed features: +- The x86 32 bits port is no longer supported under macOS. + +Compiler internals: +- Simpler translation of CompCert C casts used for their effects but + not for their values. +- Known builtins whose results are unused are eliminated earlier. +- Improved error reporting for `++` and `--` applied to pointers to + incomplete types. +- Improved error reporting for redefinitions and implicit definitions + of built-in functions. +- Added formal semantics for some PowerPC built-ins. + +The clightgen tool: +- New `-canonical-idents` mode, selected by default, to change the way + C identifiers are encoded as CompCert idents (positive numbers). + In `-canonical-idents` mode, a fixed one-to-one encoding is used + so that the same identifier occurring in different compilation units + encodes to the same number. +- The `-short-idents` flag restores the previous encoding where + C identifiers are consecutively numbered in order of appearance, + causing the same identifier to have different numbers in different + compilation units. +- Removed the automatic translation of annotation builtins to Coq + logical assertions, which was never used and possibly confusing. + +Coq and OCaml development: +- Compatibility with Coq 8.12.0, 8.11.2, 8.11.1. +- Can use already-installed Flocq and MenhirLib libraries instead of their + local copies (options `-use-external-Flocq` and `-use-external-MenhirLib` + to the `configure` script). +- Automatically build to OCaml bytecode on platforms where OCaml + native-code compilation is not available. +- Install the `compcert.config` summary of configuration choices + in the same directory as the Coq development. +- Updated the list of dual-licensed source files. + + Release 3.7, 2020-03-31 ======================= -- cgit From dc27018744ce01be26a76414fc51f8c4ff44f12b Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 9 Nov 2020 19:28:23 +0100 Subject: Update README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 250814b1..fc12093b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # CompCert -The verified C compiler. +The formally-verified C compiler. ## Overview The CompCert C verified compiler is a compiler for a large subset of the @@ -13,14 +13,14 @@ source C code. For more information on CompCert (supported platforms, supported C features, installation instructions, using the compiler, etc), please -refer to the [Web site](http://compcert.inria.fr/) and especially -the [user's manual](http://compcert.inria.fr/man/). +refer to the [Web site](https://compcert.org/) and especially +the [user's manual](https://compcert.org/man/). ## License CompCert is not free software. This non-commercial release can only be used for evaluation, research, educational and personal purposes. A commercial version of CompCert, without this restriction and with -professional support, can be purchased from +professional support and extra features, can be purchased from [AbsInt](https://www.absint.com). See the file `LICENSE` for more information. -- cgit From e87f24575e79e7866b132f0a970cf6f82d115b88 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 14 Nov 2020 09:49:28 +0100 Subject: Support Coq 8.12.1 --- Changelog | 2 +- configure | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index 8151362c..ce40e13b 100644 --- a/Changelog +++ b/Changelog @@ -35,7 +35,7 @@ The clightgen tool: logical assertions, which was never used and possibly confusing. Coq and OCaml development: -- Compatibility with Coq 8.12.0, 8.11.2, 8.11.1. +- Compatibility with Coq 8.12.1, 8.12.0, 8.11.2, 8.11.1. - Can use already-installed Flocq and MenhirLib libraries instead of their local copies (options `-use-external-Flocq` and `-use-external-MenhirLib` to the `configure` script). diff --git a/configure b/configure index fcdbe803..1620ad4b 100755 --- a/configure +++ b/configure @@ -527,14 +527,14 @@ missingtools=false echo "Testing Coq... " | tr -d '\n' coq_ver=$(${COQBIN}coqc -v 2>/dev/null | sed -n -e 's/The Coq Proof Assistant, version \([^ ]*\).*$/\1/p') case "$coq_ver" in - 8.8.0|8.8.1|8.8.2|8.9.0|8.9.1|8.10.0|8.10.1|8.10.2|8.11.0|8.11.1|8.11.2|8.12.0) + 8.8.0|8.8.1|8.8.2|8.9.0|8.9.1|8.10.0|8.10.1|8.10.2|8.11.0|8.11.1|8.11.2|8.12.0|8.12.1) echo "version $coq_ver -- good!";; ?*) echo "version $coq_ver -- UNSUPPORTED" if $ignore_coq_version; then echo "Warning: this version of Coq is unsupported, proceed at your own risks." else - echo "Error: CompCert requires a version of Coq between 8.8.0 and 8.12.0" + echo "Error: CompCert requires a version of Coq between 8.8.0 and 8.12.1" missingtools=true fi;; "") -- cgit From 27beb944ff6ff18ea612c116e414eb40ce1320a6 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 14 Nov 2020 10:09:34 +0100 Subject: Do not use -warn-error when building from a release tarball Stopping on warnings is useful for development builds, but unhelpful for released software. --- Makefile.extr | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile.extr b/Makefile.extr index b417945b..23e01614 100644 --- a/Makefile.extr +++ b/Makefile.extr @@ -50,13 +50,20 @@ INCLUDES=$(patsubst %,-I %, $(DIRS)) # Control of warnings: -WARNINGS=-w +a-4-9-27 -strict-sequence -safe-string -warn-error +a #Deprication returns with ocaml 4.03 +WARNINGS=-w +a-4-9-27 extraction/%.cmx: WARNINGS +=-w -20-27-32..34-39-41-44..45-60-67 extraction/%.cmo: WARNINGS +=-w -20-27-32..34-39-41-44..45-60-67 cparser/pre_parser.cmx: WARNINGS += -w -41 cparser/pre_parser.cmo: WARNINGS += -w -41 -COMPFLAGS+=-g $(INCLUDES) -I "$(MENHIR_DIR)" $(WARNINGS) +# Turn warnings into errors, but not for released tarballs +ifeq ($(wildcard .git),.git) +WARN_ERRORS=-warn-error +a +else +WARN_ERRORS= +endif + +COMPFLAGS+=-g -strict-sequence -safe-string $(INCLUDES) -I "$(MENHIR_DIR)" $(WARNINGS) $(WARN_ERRORS) # Using .opt compilers if available -- cgit From e6e036b3f285d2f3ba2a5036a413eb9c7d7534cd Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Mon, 16 Nov 2020 10:28:40 +0100 Subject: Updates for release 3.8 --- Changelog | 3 +++ VERSION | 2 +- doc/index.html | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Changelog b/Changelog index ce40e13b..f86691a6 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +Release 3.8, 2020-11-16 +======================= + New features: - Support `_Static_assert` from ISO C11. - Support `__builtin_constant_p` from GCC and Clang. diff --git a/VERSION b/VERSION index f544e624..d5a86723 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -version=3.7 +version=3.8 buildnr= tag= branch= diff --git a/doc/index.html b/doc/index.html index 631c5d99..ec8c4d91 100644 --- a/doc/index.html +++ b/doc/index.html @@ -24,7 +24,7 @@ a:active {color : Red; text-decoration : underline; }

The CompCert verified compiler

Commented Coq development

-

Version 3.7, 2020-03-31

+

Version 3.8, 2020-11-16

Introduction

@@ -56,12 +56,14 @@ substantially changed since the overview papers above were written.

The complete sources for CompCert can be downloaded from -the CompCert Web site.

+the Git repository +or the CompCert Web site. +

This document and the CompCert sources are copyright Institut National de Recherche en Informatique et en Automatique (INRIA) and AbsInt Angewandte Informatik GmbH, and are distributed under the terms of the -following license. +following license.

Table of contents

@@ -348,7 +350,7 @@ reconstruction.
-
Xavier.Leroy@inria.fr
+
xavier.leroy@college-de-france.fr

-- cgit