Index: doc/bibliography/pl.bib
===================================================================
--- doc/bibliography/pl.bib	(revision 655c5fa432b0d3c06bbbd9fb099aa0f6212d9551)
+++ doc/bibliography/pl.bib	(revision 3ce24255d054a251d7984a394c027f5aa3ab40ca)
@@ -943,37 +943,4 @@
 }
 
-@misc{Cforall,
-    contributer	= {pabuhr@plg},
-    key		= {Cforall},
-    author	= {{\textsf{C}{$\mathbf{\forall}$} Features}},
-    howpublished= {\href{https://plg.uwaterloo.ca/~cforall/features}{https://\-plg.uwaterloo.ca/\-$\sim$cforall/\-features}},
-}
-
-@misc{CforallBenchMarks,
-    contributer	= {pabuhr@plg},
-    key		= {Cforall Benchmarks},
-    author	= {{\textsf{C}{$\mathbf{\forall}$} Benchmarks}},
-    howpublished= {\href{https://plg.uwaterloo.ca/~cforall/benchmark.tar}{https://\-plg.uwaterloo.ca/\-$\sim$cforall/\-benchmark.tar}},
-}
-
-@mastersthesis{Esteves04,
-    keywords	= {Cforall, parametric polymorphism, overloading},
-    contributer	= {pabuhr@plg},
-    author	= {Rodolfo Gabriel Esteves},
-    title	= {\textsf{C}$\mathbf{\forall}$, a Study in Evolutionary Design in Programming Languages},
-    school	= {School of Computer Science, University of Waterloo},
-    year	= 2004,
-    address	= {Waterloo, Ontario, Canada, N2L 3G1},
-    note	= {\href{http://plg.uwaterloo.ca/theses/EstevesThesis.pdf}{http://\-plg.uwaterloo.ca/\-theses/\-EstevesThesis.pdf}},
-}
-
-@misc{CFAStackEvaluation,
-    contributer	= {a3moss@plg},
-    author	= {Aaron Moss},
-    title	= {\textsf{C}$\mathbf{\forall}$ Stack Evaluation Programs},
-    year	= 2018,
-    howpublished= {\href{https://cforall.uwaterloo.ca/CFAStackEvaluation.zip}{https://cforall.uwaterloo.ca/\-CFAStackEvaluation.zip}},
-}
-
 @article{Moss18,
     keywords	= {type systems, polymorphism, tuples, Cforall},
@@ -988,4 +955,47 @@
     pages	= {2111-2146},
     note	= {\href{http://dx.doi.org/10.1002/spe.2624}{http://\-dx.doi.org/\-10.1002/\-spe.2624}},
+}
+
+@misc{CforallBenchMarks,
+    contributer	= {pabuhr@plg},
+    key		= {Cforall Benchmarks},
+    author	= {{\textsf{C}{$\mathbf{\forall}$} Benchmarks}},
+    howpublished= {\href{https://plg.uwaterloo.ca/~cforall/benchmark.tar}{https://\-plg.uwaterloo.ca/\-$\sim$cforall/\-benchmark.tar}},
+}
+
+@misc{Cforall,
+    contributer	= {pabuhr@plg},
+    key		= {Cforall},
+    author	= {{\textsf{C}{$\mathbf{\forall}$} Features}},
+    howpublished= {\href{https://plg.uwaterloo.ca/~cforall/features}{https://\-plg.uwaterloo.ca/\-$\sim$cforall/\-features}},
+}
+
+@misc{CFAStackEvaluation,
+    contributer	= {a3moss@plg},
+    author	= {Aaron Moss},
+    title	= {\textsf{C}$\mathbf{\forall}$ Stack Evaluation Programs},
+    year	= 2018,
+    howpublished= {\href{https://cforall.uwaterloo.ca/CFAStackEvaluation.zip}{https://cforall.uwaterloo.ca/\-CFAStackEvaluation.zip}},
+}
+
+@mastersthesis{Esteves04,
+    keywords	= {Cforall, parametric polymorphism, overloading},
+    contributer	= {pabuhr@plg},
+    author	= {Rodolfo Gabriel Esteves},
+    title	= {\textsf{C}$\mathbf{\forall}$, a Study in Evolutionary Design in Programming Languages},
+    school	= {School of Computer Science, University of Waterloo},
+    year	= 2004,
+    address	= {Waterloo, Ontario, Canada, N2L 3G1},
+    note	= {\href{http://plg.uwaterloo.ca/theses/EstevesThesis.pdf}{http://\-plg.uwaterloo.ca/\-theses/\-EstevesThesis.pdf}},
+}
+
+@phdthesis{Moss19,
+    keywords 	= {type system, generic type, resolution algorithm, type environment, Cforall},
+    author	= {Aaron Moss},
+    title	= {\textsf{C}$\mathbf{\forall}$ Type System Implementation},
+    school	= {School of Computer Science, University of Waterloo},
+    year	= 2019,
+    optaddress	= {Waterloo, Ontario, Canada, N2L 3G1},
+    note	= {\href{https://uwspace.uwaterloo.ca/handle/10012/14584}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-14584}},
 }
 
@@ -1101,10 +1111,10 @@
 
 @techreport{Prokopec11,
-  keywords = {ctrie, concurrent map},
-  contributer = {a3moss@uwaterloo.ca}, 
-  title={Cache-aware lock-free concurrent hash tries},
-  author={Prokopec, Aleksandar and Bagwell, Phil and Odersky, Martin},
-  institution={EPFL},
-  year={2011}
+    keywords	= {ctrie, concurrent map},
+    contributer = {a3moss@uwaterloo.ca}, 
+    title	={Cache-aware lock-free concurrent hash tries},
+    author	={Prokopec, Aleksandar and Bagwell, Phil and Odersky, Martin},
+    institution	={EPFL},
+    year	={2011}
 }
 
@@ -1158,8 +1168,8 @@
 
 @phdthesis{Norrish98,
-  title={C formalised in HOL},
-  author={Norrish, Michael},
-  year={1998},
-  school={University of Cambridge}
+    title	= {C formalised in HOL},
+    author	= {Norrish, Michael},
+    year	= {1998},
+    school	= {University of Cambridge}
 }
 
@@ -1170,8 +1180,8 @@
     title	= {Checked C: Making C Safe by Extension},
     booktitle	= {2018 IEEE Cybersecurity Development (SecDev)},
+    publisher	= {IEEE},
     year	= {2018},
-    month	= {September},
+    month	= sep,
     pages	= {53-60},
-    publisher	= {IEEE},
     url		= {https://www.microsoft.com/en-us/research/publication/checkedc-making-c-safe-by-extension/},
 }
@@ -1285,20 +1295,20 @@
 
 @inproceedings{Odersky01,
- keywords = {Scala},
- contributer = {a3moss@uwaterloo.ca},
- author = {Odersky, Martin and Zenger, Christoph and Zenger, Matthias},
- title = {Colored Local Type Inference},
- booktitle = {Proceedings of the 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages},
- series = {POPL '01},
- year = {2001},
- isbn = {1-58113-336-7},
- location = {London, United Kingdom},
- pages = {41--53},
- numpages = {13},
- url = {http://doi.acm.org/10.1145/360204.360207},
- doi = {10.1145/360204.360207},
- acmid = {360207},
- publisher = {ACM},
- address = {New York, NY, USA},
+    keywords	= {Scala},
+    contributer	= {a3moss@uwaterloo.ca},
+    author	= {Odersky, Martin and Zenger, Christoph and Zenger, Matthias},
+    title	= {Colored Local Type Inference},
+    booktitle	= {Proceedings of the 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages},
+    series	= {POPL '01},
+    year	= {2001},
+    isbn	= {1-58113-336-7},
+    location	= {London, United Kingdom},
+    pages	= {41--53},
+    numpages	= {13},
+    url		= {http://doi.acm.org/10.1145/360204.360207},
+    doi		= {10.1145/360204.360207},
+    acmid	= {360207},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
 }
 
@@ -1693,14 +1703,14 @@
 
 @inproceedings{Prokopec12,
-  keywords={ctrie, hash trie, concurrent map},
-  contributer={a3moss@uwaterloo.ca},
-  title={Concurrent tries with efficient non-blocking snapshots},
-  author={Prokopec, Aleksandar and Bronson, Nathan Grasso and Bagwell, Phil and Odersky, Martin},
-  booktitle={ACM SIGPLAN Notices},
-  volume={47},
-  number={8},
-  pages={151--160},
-  year={2012},
-  organization={ACM}
+    keywords	= {ctrie, hash trie, concurrent map},
+    contributer	= {a3moss@uwaterloo.ca},
+    title	= {Concurrent tries with efficient non-blocking snapshots},
+    author	= {Prokopec, Aleksandar and Bronson, Nathan Grasso and Bagwell, Phil and Odersky, Martin},
+    booktitle	= {ACM SIGPLAN Notices},
+    volume	= {47},
+    number	= {8},
+    pages	= {151--160},
+    year	= {2012},
+    organization={ACM}
 }
 
@@ -1729,12 +1739,12 @@
 }
 
-@article{Delisle18b,
+@article{Delisle19,
     keywords	= {concurrency, Cforall},
     contributer	= {pabuhr@plg},
     author	= {Thierry Delisle and Peter A. Buhr},
-    title	= {Concurrency in \textsf{C}$\mathbf{\forall}$},
-    year	= 2018,
+    title	= {Advanced Control-flow and Concurrency in \textsf{C}$\mathbf{\forall}$},
+    year	= 2019,
     journal	= spe,
-    pages	= {1-32},
+    pages	= {1-33},
     note	= {submitted},
 }
@@ -2500,10 +2510,10 @@
 
 @misc{Dotty-github,
-    keywords = {dotty,scala},
-    contributer = {a3moss@uwaterloo.ca},
-    author = {Martin Odersky},
-    title = {Dotty},
-    howpublished = {\href{https://github.com/lampepfl/dotty}{https://\-github.com/\-lampepfl/\-dotty}},
-    note = {Acessed: 2019-02-22}
+    keywords	= {dotty,scala},
+    contributer	= {a3moss@uwaterloo.ca},
+    author	= {Martin Odersky},
+    title	= {Dotty},
+    howpublished= {\href{https://github.com/lampepfl/dotty}{https://\-github.com/\-lampepfl/\-dotty}},
+    note	= {Acessed: 2019-02-22}
 }
 
@@ -2656,5 +2666,5 @@
     volume	= 10,
     number	= 3,
-    pages	 = {120-123},
+    pages	= {120-123},
     comment	= {
         The ``two-pass'' algorithm.  An upward pass over a parse tree
@@ -3236,22 +3246,22 @@
 
 @article{Leroy09,
- keywords = {C formalization},
- contributer = {a3moss@uwaterloo.ca},
- author = {Leroy, Xavier},
- title = {Formal Verification of a Realistic Compiler},
- journal = {Commun. ACM},
- issue_date = {July 2009},
- volume = {52},
- number = {7},
- month = jul,
- year = {2009},
- issn = {0001-0782},
- pages = {107--115},
- numpages = {9},
- url = {http://doi.acm.org/10.1145/1538788.1538814},
- doi = {10.1145/1538788.1538814},
- acmid = {1538814},
- publisher = {ACM},
- address = {New York, NY, USA},
+    keywords	= {C formalization},
+    contributer	= {a3moss@uwaterloo.ca},
+    author	= {Leroy, Xavier},
+    title	= {Formal Verification of a Realistic Compiler},
+    journal	= {Commun. ACM},
+    issue_date	= {July 2009},
+    volume	= {52},
+    number	= {7},
+    month	= jul,
+    year	= {2009},
+    issn	= {0001-0782},
+    pages	= {107--115},
+    numpages	= {9},
+    url		= {http://doi.acm.org/10.1145/1538788.1538814},
+    doi		= {10.1145/1538788.1538814},
+    acmid	= {1538814},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
 } 
 
@@ -4181,14 +4191,14 @@
 
 @article{Morgado13,
-  keywords = {expression resolution},
-  contributer = {a3moss@uwaterloo.ca},
-  title={Iterative and core-guided {MaxSAT} solving: A survey and assessment},
-  author={Morgado, Antonio and Heras, Federico and Liffiton, Mark and Planes, Jordi and Marques-Silva, Joao},
-  journal={Constraints},
-  volume={18},
-  number={4},
-  pages={478--534},
-  year={2013},
-  publisher={Springer}
+    keywords	= {expression resolution},
+    contributer	= {a3moss@uwaterloo.ca},
+    title	= {Iterative and core-guided {MaxSAT} solving: A survey and assessment},
+    author	= {Morgado, Antonio and Heras, Federico and Liffiton, Mark and Planes, Jordi and Marques-Silva, Joao},
+    journal	= {Constraints},
+    volume	= {18},
+    number	= {4},
+    pages	= {478--534},
+    year	= {2013},
+    publisher	= {Springer}
 }
 
@@ -4389,5 +4399,4 @@
 }
 
-
 @article{Liskov86,
     keywords	= {synchronous communication, concurrency},
@@ -4448,23 +4457,23 @@
 
 @article{Pierce00,
- keywords = {Scala},
- contributer = {a3moss@uwaterloo.ca},
- author = {Pierce, Benjamin C. and Turner, David N.},
- title = {Local Type Inference},
- journal = {ACM Trans. Program. Lang. Syst.},
- issue_date = {Jan. 2000},
- volume = {22},
- number = {1},
- month = jan,
- year = {2000},
- issn = {0164-0925},
- pages = {1--44},
- numpages = {44},
- url = {http://doi.acm.org/10.1145/345099.345100},
- doi = {10.1145/345099.345100},
- acmid = {345100},
- publisher = {ACM},
- address = {New York, NY, USA},
- keywords = {polymorphism, subtyping, type inference},
+    keywords	= {Scala},
+    contributer	= {a3moss@uwaterloo.ca},
+    author	= {Pierce, Benjamin C. and Turner, David N.},
+    title	= {Local Type Inference},
+    journal	= {ACM Trans. Program. Lang. Syst.},
+    issue_date	= {Jan. 2000},
+    volume	= {22},
+    number	= {1},
+    month	= jan,
+    year	= {2000},
+    issn	= {0164-0925},
+    pages	= {1--44},
+    numpages	= {44},
+    url		= {http://doi.acm.org/10.1145/345099.345100},
+    doi		= {10.1145/345099.345100},
+    acmid	= {345100},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
+    keywords	= {polymorphism, subtyping, type inference},
 } 
 
@@ -5449,20 +5458,20 @@
 
 @inproceedings{Krebbers14,
- keywords = {c formalization},
- contributer = {a3moss@uwaterloo.ca},
- author = {Krebbers, Robbert},
- title = {An Operational and Axiomatic Semantics for Non-determinism and Sequence Points in C},
- booktitle = {Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages},
- series = {POPL '14},
- year = {2014},
- isbn = {978-1-4503-2544-8},
- location = {San Diego, California, USA},
- pages = {101--112},
- numpages = {12},
- url = {http://doi.acm.org/10.1145/2535838.2535878},
- doi = {10.1145/2535838.2535878},
- acmid = {2535878},
- publisher = {ACM},
- address = {New York, NY, USA},
+    keywords	= {c formalization},
+    contributer	= {a3moss@uwaterloo.ca},
+    author	= {Krebbers, Robbert},
+    title	= {An Operational and Axiomatic Semantics for Non-determinism and Sequence Points in C},
+    booktitle	= {Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages},
+    series	= {POPL '14},
+    year	= {2014},
+    isbn	= {978-1-4503-2544-8},
+    location	= {San Diego, California, USA},
+    pages	= {101--112},
+    numpages	= {12},
+    url		= {http://doi.acm.org/10.1145/2535838.2535878},
+    doi		= {10.1145/2535838.2535878},
+    acmid	= {2535878},
+    publisher	= {ACM},
+    address	= {New York, NY, USA},
 } 
 
@@ -7531,11 +7540,11 @@
 
 @article{SysVABI,
-  keywords = {System V ABI},
-  contributer = {a3moss@uwaterloo.ca},
-  title={System {V} application binary interface},
-  author={Matz, Michael and Hubicka, Jan and Jaeger, Andreas and Mitchell, Mark},
-  journal={AMD64 Architecture Processor Supplement, Draft v0},
-  volume={99},
-  year={2013}
+    keywords	=  {System V ABI},
+    contributer	=  {a3moss@uwaterloo.ca},
+    title	= {System {V} application binary interface},
+    author	= {Matz, Michael and Hubicka, Jan and Jaeger, Andreas and Mitchell, Mark},
+    journal	= {AMD64 Architecture Processor Supplement, Draft v0},
+    volume	= {99},
+    year	= {2013}
 }
 
@@ -7764,8 +7773,8 @@
 
 @techreport{Black90,
-  title={Typechecking polymorphism in {Emerald}},
-  author={Black, Andrew P and Hutchinson, Norman C},
-  year={1990},
-  institution={Cambridge Research Laboratory, Digital Equipment Corporation}
+    title	= {Typechecking polymorphism in {Emerald}},
+    author	= {Black, Andrew P and Hutchinson, Norman C},
+    year	= {1990},
+    institution	= {Cambridge Research Laboratory, Digital Equipment Corporation}
 }
 
Index: driver/cc1.cc
===================================================================
--- driver/cc1.cc	(revision 655c5fa432b0d3c06bbbd9fb099aa0f6212d9551)
+++ driver/cc1.cc	(revision 3ce24255d054a251d7984a394c027f5aa3ab40ca)
@@ -10,6 +10,6 @@
 // Created On       : Fri Aug 26 14:23:51 2005
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Sep  3 16:57:05 2018
-// Update Count     : 125
+// Last Modified On : Fri Aug 30 15:36:42 2019
+// Update Count     : 377
 //
 
@@ -19,8 +19,11 @@
 #include <string>
 using std::string;
+#include <algorithm>									// find
 #include <cstdio>										// stderr, stdout, perror, fprintf
 #include <cstdlib>										// getenv, exit, mkstemp
 #include <unistd.h>										// execvp, fork, unlink
 #include <sys/wait.h>									// wait
+#include <fcntl.h>
+
 
 #include "config.h"										// configure info
@@ -30,111 +33,122 @@
 
 
-string compiler_name( CFA_BACKEND_CC );					// path/name of C compiler
-
-string D__GCC_BPREFIX__( "-D__GCC_BPREFIX__=" );
-string D__CFA_FLAGPREFIX__( "-D__CFA_FLAG__=" );
-
-char tmpname[] = P_tmpdir "/CFAXXXXXX";
-int tmpfilefd = -1;
-
-
-bool prefix( string arg, string pre ) {
+static string compiler_path( CFA_BACKEND_CC );			// C compiler path/name
+static bool CFA_flag = false;							// -CFA flag
+static bool save_temps = false;							// -save-temps flag
+static string o_file;
+static string bprefix;
+
+
+static bool prefix( const string & arg, const string & pre ) {
 	return arg.substr( 0, pre.size() ) == pre;
 } // prefix
 
-enum { NumSuffixes = 2 };
-const string suffixes[NumSuffixes] = { "cfa", "hfa", };
-
-void suffix( string arg, const char * args[], int & nargs ) {
-	//std::cerr << arg << std::endl;
+static void suffix( const string & arg, const char * args[], int & nargs ) {
+	enum { NumSuffixes = 3 };
+	static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" };
+
 	size_t dot = arg.find_last_of( "." );
-	//std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
 	if ( dot == string::npos ) return;
-	string sx = arg.substr( dot + 1 );
-	for ( int i = 0; i < NumSuffixes; i += 1 ) {
-		if ( sx == suffixes[i] ) {
-			args[nargs] = "-x";
-			nargs += 1;
-			args[nargs] = "c";
-			nargs += 1;
-			return;
-		} // if
-	} // for
+	const string * end = suffixes + NumSuffixes;
+	if ( std::find( suffixes, end, arg.substr( dot + 1 ) ) != end ) {
+		args[nargs++] = "-x";
+		args[nargs++] = "c";
+	} // if
 } // suffix
 
 
-void checkEnv( const char * args[], int & nargs ) {
-	char *value;
-
-	value = getenv( "__CFA_COMPILER__" );
-	if ( value != NULL ) {
-		compiler_name = value;
-		#ifdef __DEBUG_H__
-		cerr << "env arg:\"" << compiler_name << "\"" << endl;
-		#endif // __DEBUG_H__
-	} // if
-
-	value = getenv( "__GCC_MACHINE__" );
-	if ( value != NULL ) {
-		args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along
-		#ifdef __DEBUG_H__
-		cerr << "env arg:\"" << args[nargs] << "\"" << endl;
-		#endif // __DEBUG_H__
-		nargs += 1;
-	} // if
-
-	value = getenv( "__GCC_VERSION__" );
-	if ( value != NULL ) {
-		args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along
-		#ifdef __DEBUG_H__
-		cerr << "env arg:\"" << args[nargs] << "\"" << endl;
-		#endif // __DEBUG_H__
-		nargs += 1;
-	} // if
-} // checkEnv
-
-
-void rmtmpfile() {
+static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );
+
+static void checkEnv1( const char * args[], int & nargs ) { // stage 1
+	extern char ** environ;
+
+	for ( int i = 0; environ[i]; i += 1 ) {
+		string arg( environ[i] );
+		#ifdef __DEBUG_H__
+		cerr << "env arg:\"" << arg << "\"" << endl;
+		#endif // __DEBUG_H__
+
+		if ( prefix( arg, __CFA_FLAGPREFIX__ ) ) {
+			string val( arg.substr( __CFA_FLAGPREFIX__.size() + 4 ) );
+			if ( prefix( val, "-compiler=" ) ) {
+				compiler_path = val.substr( 10 );
+			} // if
+		} // if
+	} // for
+} // checkEnv1
+
+
+static void checkEnv2( const char * args[], int & nargs ) { // stage 2
+	extern char ** environ;
+
+	for ( int i = 0; environ[i]; i += 1 ) {
+		string arg( environ[i] );
+		#ifdef __DEBUG_H__
+		cerr << "env arg:\"" << arg << "\"" << endl;
+		#endif // __DEBUG_H__
+
+		if ( prefix( arg, __CFA_FLAGPREFIX__ ) ) {
+			string val( arg.substr( __CFA_FLAGPREFIX__.size() + 4 ) );
+			if ( prefix( val, "-compiler=" ) ) {
+				compiler_path = val.substr( 10 );
+			} else if ( val == "-CFA" ) {
+				CFA_flag = true;
+			} else if ( val == "-save-temps" ) {
+				save_temps = true;
+			} else if ( prefix( val, "-o=" ) ) {		// output file for -CFA
+				o_file = val.substr( 3 );
+			} else if ( prefix( val, "-B=" ) ) {		// location of cfa-cpp
+				bprefix = val.substr( 3 );
+			} else {									// normal flag for cfa-cpp
+				args[nargs++] = ( *new string( arg.substr( __CFA_FLAGPREFIX__.size() + 4 ) ) ).c_str();
+			} // if
+		} // if
+	} // for
+} // checkEnv2
+
+
+static char tmpname[] = P_tmpdir "/CFAXXXXXX.i";
+static int tmpfilefd = -1;
+static bool startrm = false;
+
+static void rmtmpfile() {
+	if ( tmpfilefd == -1 ) return;						// RACE, file created ?
+
+	startrm = true;										// RACE with C-c C-c
 	if ( unlink( tmpname ) == -1 ) {					// remove tmpname
-		perror ( "CFA Translator error: cpp failed" );
-		exit( EXIT_FAILURE );
-	} // if
-	tmpfilefd = -1;										// mark closed
+		perror ( "CC1 Translator error: failed, unlink" );
+		exit( EXIT_FAILURE );
+	} // if
+	tmpfilefd = -1;										// mark removed
 } // rmtmpfile
 
 
-void sigTermHandler( __attribute__((unused)) int signal ) {
+static void sigTermHandler( int ) {						// C-c C-c
+	if ( startrm ) return;								// return and let rmtmpfile finish, and then program finishes
+
 	if ( tmpfilefd != -1 ) {							// RACE, file created ?
-		rmtmpfile();									// remove
-		exit( EXIT_FAILURE );							// terminate
-	} // if
+		rmtmpfile();									// remove tmpname
+	} // if
+	exit( EXIT_FAILURE );								// terminate
 } // sigTermHandler
 
 
-void Stage1( const int argc, const char * const argv[] ) {
+static void Stage1( const int argc, const char * const argv[] ) {
 	int code;
-
 	string arg;
-	string bprefix;
-
-	const char *cpp_in = NULL;
-	const char *cpp_out = NULL;
-
-	bool CFA_flag = false;
+
+	const char * cpp_in = nullptr;
+	const char * cpp_out = nullptr;
+
 	bool cpp_flag = false;
-	const char *o_name = NULL;
-
-	const char *args[argc + 100];						// leave space for 100 additional cpp command line values
+	bool o_flag = false;
+
+	const char * args[argc + 100];						// leave space for 100 additional cpp command line values
 	int nargs = 1;										// number of arguments in args list; 0 => command name
-	const char *cargs[20];								// leave space for 20 additional cfa-cpp command line values
-	int ncargs = 1;										// 0 => command name
-
-	signal( SIGINT,  sigTermHandler );
-	signal( SIGTERM, sigTermHandler );
 
 	#ifdef __DEBUG_H__
 	cerr << "Stage1" << endl;
 	#endif // __DEBUG_H__
-	checkEnv( args, nargs );							// arguments passed via environment variables
+	checkEnv1( args, nargs );							// arguments passed via environment variables
 	#ifdef __DEBUG_H__
 	for ( int i = 1; i < argc; i += 1 ) {
@@ -168,30 +182,13 @@
 				i += 1;									// and the argument
 				cpp_flag = true;
-			} else if ( arg == "-D__CFA_PREPROCESS__" ) {
-				CFA_flag = true;
-			} else if ( arg == "-D" && string( argv[i + 1] ) == "__CFA_PREPROCESS__" ) {
-				i += 1;									// and the argument
-				CFA_flag = true;
-			} else if ( prefix( arg, D__CFA_FLAGPREFIX__ ) ) {
-				cargs[ncargs] = ( *new string( arg.substr( D__CFA_FLAGPREFIX__.size() ) ) ).c_str();
-				ncargs += 1;
-			} else if ( arg == "-D" && prefix( argv[i + 1], D__CFA_FLAGPREFIX__.substr(2) ) ) {
-				cargs[ncargs] = ( *new string( string( argv[i + 1] ).substr( D__CFA_FLAGPREFIX__.size() - 2 ) ) ).c_str();
-				ncargs += 1;
-				i += 1;									// and the argument
-			} else if ( prefix( arg, D__GCC_BPREFIX__ ) ) {
-				bprefix = arg.substr( D__GCC_BPREFIX__.size() );
-			} else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_BPREFIX__.substr(2) ) ) {
-				bprefix = string( argv[i + 1] ).substr( D__GCC_BPREFIX__.size() - 2 );
-				i += 1;									// and the argument
-
-			// all other flags
+
+				// all other flags
 
 			} else if ( arg == "-o" ) {
 				i += 1;
-				o_name = argv[i];
+				o_flag = true;
+				cpp_out = argv[i];
 			} else {
-				args[nargs] = argv[i];					// pass the flag along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass the flag along
 				// CPP flags with an argument
 				if ( arg == "-D" || arg == "-U" || arg == "-I" || arg == "-MF" || arg == "-MT" || arg == "-MQ" ||
@@ -199,15 +196,12 @@
 					 arg == "-iwithprefix" || arg == "-iwithprefixbefore" || arg == "-isystem" || arg == "-isysroot" ) {
 					i += 1;
-					args[nargs] = argv[i];				// pass the argument along
-					nargs += 1;
+					args[nargs++] = argv[i];			// pass the argument along
 					#ifdef __DEBUG_H__
 					cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
 					#endif // __DEBUG_H__
 				} else if ( arg == "-MD" || arg == "-MMD" ) {
-					args[nargs] = "-MF";				// insert before file
-					nargs += 1;
+					args[nargs++] = "-MF";				// insert before file
 					i += 1;
-					args[nargs] = argv[i];				// pass the argument along
-					nargs += 1;
+					args[nargs++] = argv[i];			// pass the argument along
 					#ifdef __DEBUG_H__
 					cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
@@ -216,10 +210,10 @@
 			} // if
 		} else {										// obtain input and possibly output files
-			if ( cpp_in == NULL ) {
+			if ( cpp_in == nullptr ) {
 				cpp_in = argv[i];
 				#ifdef __DEBUG_H__
 				cerr << "cpp_in:\"" << cpp_in << "\"" << endl;
 				#endif // __DEBUG_H__
-			} else if ( cpp_out == NULL ) {
+			} else if ( cpp_out == nullptr ) {
 				cpp_out = argv[i];
 				#ifdef __DEBUG_H__
@@ -238,10 +232,10 @@
 		cerr << " " << args[i];
 	} // for
-	if ( cpp_in != NULL ) cerr << " " << cpp_in;
-	if ( cpp_out != NULL ) cerr << " " << cpp_out;
+	if ( cpp_in != nullptr ) cerr << " " << cpp_in;
+	if ( cpp_out != nullptr ) cerr << " " << cpp_out;
 	cerr << endl;
 	#endif // __DEBUG_H__
 
-	if ( cpp_in == NULL ) {
+	if ( cpp_in == nullptr ) {
 		cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl;
 		exit( EXIT_FAILURE );
@@ -252,19 +246,16 @@
 		// output or -o. The call to cfa has a -E so it does not have to be added to the argument list.
 
-		args[0] = compiler_name.c_str();
+		args[0] = compiler_path.c_str();
 		suffix( cpp_in, args, nargs );					// check suffix
-		args[nargs] = cpp_in;
-		nargs += 1;
-		if ( o_name != NULL ) {							// location for output
-			args[nargs] = "-o";
-			nargs += 1;
-			args[nargs] = o_name;
-			nargs += 1;
-		} // if
-		args[nargs] = NULL;								// terminate argument list
+		args[nargs++] = cpp_in;
+		if ( o_flag ) {									// location for output
+			args[nargs++] = "-o";
+		} // if
+		args[nargs++] = cpp_out;
+		args[nargs] = nullptr;							// terminate argument list
 
 		#ifdef __DEBUG_H__
 		cerr << "nargs: " << nargs << endl;
-		for ( int i = 0; args[i] != NULL; i += 1 ) {
+		for ( int i = 0; args[i] != nullptr; i += 1 ) {
 			cerr << args[i] << " ";
 		} // for
@@ -272,22 +263,10 @@
 		#endif // __DEBUG_H__
 
-		execvp( args[0], (char *const *)args );			// should not return
-		perror( "CFA Translator error: cpp level, execvp" );
-		exit( EXIT_FAILURE );
-	} // if
-
-	// Create a temporary file to store output of the C preprocessor.
-
-	tmpfilefd = mkstemp( tmpname );
-	if ( tmpfilefd == -1 ) {
-		perror( "CFA Translator error: cpp level, mkstemp" );
-		exit( EXIT_FAILURE );
-	} // if
-
-	#ifdef __DEBUG_H__
-	cerr << "tmpname:" << tmpname << " tmpfilefd:" << tmpfilefd << endl;
-	#endif // __DEBUG_H__
-
-	// Run the C preprocessor and save the output in tmpfile.
+		execvp( args[0], (char * const *)args );		// should not return
+		perror( "CC1 Translator error: stage 1, execvp" );
+		exit( EXIT_FAILURE );
+	} // if
+
+	// Run the C preprocessor and save the output in the given file.
 
 	if ( fork() == 0 ) {								 // child process ?
@@ -295,18 +274,17 @@
 		// an error (e.g., cannot find include file). Whereas, output is always generated, even when there is an error,
 		// when cpp writes to stdout. Hence, stdout is redirected into the temporary file.
-		if ( freopen( tmpname, "w", stdout ) == NULL ) { // redirect stdout to tmpname
-			perror( "CFA Translator error: cpp level, freopen" );
+		if ( freopen( cpp_out, "w", stdout ) == nullptr ) { // redirect stdout to output file
+			perror( "CC1 Translator error: stage 1, freopen" );
 			exit( EXIT_FAILURE );
 		} // if
 
-		args[0] = compiler_name.c_str();
+		args[0] = compiler_path.c_str();
 		suffix( cpp_in, args, nargs );					// check suffix
-		args[nargs] = cpp_in;							// input to cpp
-		nargs += 1;
-		args[nargs] = NULL;								// terminate argument list
+		args[nargs++] = cpp_in;							// input to cpp
+		args[nargs] = nullptr;							// terminate argument list
 
 		#ifdef __DEBUG_H__
 		cerr << "cpp nargs: " << nargs << endl;
-		for ( int i = 0; args[i] != NULL; i += 1 ) {
+		for ( int i = 0; args[i] != nullptr; i += 1 ) {
 			cerr << args[i] << " ";
 		} // for
@@ -314,6 +292,7 @@
 		#endif // __DEBUG_H__
 
-		execvp( args[0], (char *const *)args );			// should not return
-		perror( "CFA Translator error: cpp level, execvp" );
+		execvp( args[0], (char * const *)args );		// should not return
+		perror( "CC1 Translator error: stage 1 cpp, execvp" );
+		cerr << " invoked " << args[0] << endl;
 		exit( EXIT_FAILURE );
 	} // if
@@ -325,81 +304,29 @@
 	#endif // __DEBUG_H__
 
-	if ( WIFSIGNALED(code) != 0 ) {						// child failed ?
-		rmtmpfile();									// remove tmpname
-		cerr << "CFA Translator error: cpp failed with signal " << WTERMSIG(code) << endl;
-		exit( EXIT_FAILURE );
-	} // if
-
-	if ( WEXITSTATUS(code) != 0 ) {						// child error ?
-		rmtmpfile();									// remove tmpname
-		exit( WEXITSTATUS( code ) );					// do not continue
-	} // if
-
-	// If -CFA flag specified, run the cfa-cpp preprocessor on the temporary file, and output is written to standard
-	// output.  Otherwise, run the cfa-cpp preprocessor on the temporary file and save the result into the output file.
-
-	if ( fork() == 0 ) {								// child runs CFA
-		cargs[0] = ( *new string( bprefix + "cfa-cpp" ) ).c_str();
-
-		// Source file-name used to generate routine names containing global initializations for TU.
-		cargs[ncargs] = ( *new string( "-F" ) ).c_str();
-		ncargs += 1;
-		cargs[ncargs] = ( *new string( string( cpp_in ) ) ).c_str();
-		ncargs += 1;
-
-		cargs[ncargs] = tmpname;
-		ncargs += 1;
-		if ( o_name != NULL ) {
-			cargs[ncargs] = o_name;
-			ncargs += 1;
-		} else if ( ! CFA_flag ) {						// run cfa-cpp ?
-			cargs[ncargs] = cpp_out;
-			ncargs += 1;
-		} // if
-		cargs[ncargs] = NULL;							// terminate argument list
-
-		#ifdef __DEBUG_H__
-		cerr << "cfa-cpp ncargs: " << (o_name ? o_name : "No -o") << " " << CFA_flag << " " << ncargs << endl;
-		for ( int i = 0; cargs[i] != NULL; i += 1 ) {
-			cerr << cargs[i] << " ";
-		} // for
-		cerr << endl;
-		#endif // __DEBUG_H__
-
-		execvp( cargs[0], (char * const *)cargs );		// should not return
-		perror( "CFA Translator error: cpp level, execvp" );
-		exit( EXIT_FAILURE );
-	} // if
-
-	wait( &code );										// wait for child to finish
-
-	#ifdef __DEBUG_H__
-	cerr << "return code from cfa-cpp:" << WEXITSTATUS(code) << endl;
-	#endif // __DEBUG_H__
-
-	// Must unlink here because file must exist across execvp.
-	rmtmpfile();										// remove tmpname
-
 	if ( WIFSIGNALED(code) ) {							// child failed ?
-		cerr << "CFA Translator error: cfa-cpp failed with signal " << WTERMSIG(code) << endl;
-		exit( EXIT_FAILURE );
-	} // if
-
-	exit( WEXITSTATUS(code) );
+		cerr << "CC1 Translator error: stage 1, child failed " << WTERMSIG(code) << endl;
+		exit( EXIT_FAILURE );
+	} // if
+
+	exit( WEXITSTATUS(code) );							// bad cpp result stops top-level gcc
 } // Stage1
 
 
-void Stage2( const int argc, const char * const * argv ) {
+static void Stage2( const int argc, const char * const * argv ) {
+	int code;
 	string arg;
 
-	const char *cpp_in = NULL;
-
-	const char *args[argc + 100];						// leave space for 100 additional cfa command line values
+	const char * cpp_in = nullptr;
+	const char * cpp_out = nullptr;
+
+	const char * args[argc + 100];						// leave space for 100 additional cfa command line values
 	int nargs = 1;										// number of arguments in args list; 0 => command name
+	const char * cargs[20];								// leave space for 20 additional cfa-cpp command line values
+	int ncargs = 1;										// 0 => command name
 
 	#ifdef __DEBUG_H__
 	cerr << "Stage2" << endl;
 	#endif // __DEBUG_H__
-	checkEnv( args, nargs );							// arguments passed via environment variables
+	checkEnv2( cargs, ncargs );							// arguments passed via environment variables
 	#ifdef __DEBUG_H__
 	for ( int i = 1; i < argc; i += 1 ) {
@@ -430,10 +357,9 @@
 
 			} else {
-				args[nargs] = argv[i];					// pass the flag along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass the flag along
 				if ( arg == "-o" ) {
 					i += 1;
-					args[nargs] = argv[i];				// pass the argument along
-					nargs += 1;
+					cpp_out = argv[i];
+					args[nargs++] = argv[i];			// pass the argument along
 					#ifdef __DEBUG_H__
 					cerr << "arg:\"" << argv[i] << "\"" << endl;
@@ -442,15 +368,111 @@
 			} // if
 		} else {										// obtain input and possibly output files
-			if ( cpp_in == NULL ) {
+			if ( cpp_in == nullptr ) {
 				cpp_in = argv[i];
 				#ifdef __DEBUG_H__
 				cerr << "cpp_in:\"" << cpp_in << "\"" << endl;
 				#endif // __DEBUG_H__
+			} else if ( cpp_out == nullptr ) {
+				cpp_out = argv[i];
+				#ifdef __DEBUG_H__
+				cerr << "cpp_out:\"" << cpp_out << "\""<< endl;
+				#endif // __DEBUG_H__
 			} else {
-				cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl;
+				cerr << "Usage: " << argv[0] << " more than two files specified" << endl;
 				exit( EXIT_FAILURE );
 			} // if
 		} // if
 	} // for
+
+	if ( cpp_in == nullptr ) {
+		cerr << "Usage: " << argv[0] << " missing input file" << endl;
+		exit( EXIT_FAILURE );
+	} // if
+	if ( cpp_out == nullptr ) {
+		cerr << "Usage: " << argv[0] << " missing output file" << endl;
+		exit( EXIT_FAILURE );
+	} // if
+
+	// Create a temporary file, if needed, to store output of the cfa-cpp preprocessor. Cannot be created in forked
+	// process because variables tmpname and tmpfilefd are cloned.
+
+	string cfa_cpp_out;
+
+	if ( ! CFA_flag ) {									// run compiler ?
+		if ( save_temps ) {
+			cfa_cpp_out = cpp_in;
+			size_t dot = cfa_cpp_out.find_last_of( "." );
+			if ( dot == string::npos ) {
+				cerr << "CC1 Translator error: stage 2, bad file name " << endl;
+				exit( EXIT_FAILURE );
+			} // if
+
+			cfa_cpp_out = cfa_cpp_out.substr( 0, dot ) + ".ifa";
+			if ( creat( cfa_cpp_out.c_str(), 0666 ) == -1 ) {
+				perror( "CC1 Translator error: stage 2, creat" );
+				exit( EXIT_FAILURE );
+			} // if
+		} else {
+			tmpfilefd = mkstemps( tmpname, 2 );
+			if ( tmpfilefd == -1 ) {
+				perror( "CC1 Translator error: stage 2, mkstemp" );
+				exit( EXIT_FAILURE );
+			} // if
+			cfa_cpp_out = tmpname;
+		} // if
+		#ifdef __DEBUG_H__
+		cerr << "cfa_cpp_out: " << cfa_cpp_out << endl;
+		#endif // __DEBUG_H__
+	} // if
+
+	// If -CFA flag specified, run the cfa-cpp preprocessor on the temporary file, and output is written to standard
+	// output.  Otherwise, run the cfa-cpp preprocessor on the temporary file and save the result into the output file.
+
+	if ( fork() == 0 ) {								// child runs CFA
+		cargs[0] = ( *new string( bprefix + "cfa-cpp" ) ).c_str();
+		cargs[ncargs++] = cpp_in;
+
+		if ( CFA_flag ) {								// run cfa-cpp ?
+			if ( o_file.size() != 0 ) {					// location for output
+				cargs[ncargs++] = ( *new string( o_file.c_str() ) ).c_str();
+			} // if
+		} else {
+			cargs[ncargs++] = cfa_cpp_out.c_str();
+		} // if
+		cargs[ncargs] = nullptr;						// terminate argument list
+
+		#ifdef __DEBUG_H__
+		for ( int i = 0; cargs[i] != nullptr; i += 1 ) {
+			cerr << cargs[i] << " ";
+		} // for
+		cerr << endl;
+		#endif // __DEBUG_H__
+
+		execvp( cargs[0], (char * const *)cargs );		// should not return
+		perror( "CC1 Translator error: stage 2 cfa-cpp, execvp" );
+		cerr << " invoked " << cargs[0] << endl;
+		exit( EXIT_FAILURE );
+	} // if
+
+	wait( &code );										// wait for child to finish
+
+	if ( WIFSIGNALED(code) ) {							// child failed ?
+		rmtmpfile();									// remove tmpname
+		cerr << "CC1 Translator error: stage 2, child failed " << WTERMSIG(code) << endl;
+		exit( EXIT_FAILURE );
+	} // if
+
+	if ( CFA_flag ) {									// no tmpfile created
+		exit( WEXITSTATUS( code ) );					// stop regardless of success or failure
+	} // if
+
+	#ifdef __DEBUG_H__
+	cerr << "return code from cfa-cpp:" << WEXITSTATUS(code) << endl;
+	#endif // __DEBUG_H__
+
+	if ( WEXITSTATUS(code) ) {							// child error ?
+		rmtmpfile();									// remove tmpname
+		exit( WEXITSTATUS( code ) );					// do not continue
+	} // if
 
 	#ifdef __DEBUG_H__
@@ -459,37 +481,64 @@
 		cerr << " " << args[i];
 	} // for
-	cerr << endl;
-	if ( cpp_in != NULL ) cerr << " " << cpp_in;
-	#endif // __DEBUG_H__
-
-	args[0] = compiler_name.c_str();
-	args[nargs] = "-S";									// only compile and put assembler output in specified file
-	nargs += 1;
-	args[nargs] = cpp_in;
-	nargs += 1;
-	args[nargs] = NULL;									// terminate argument list
-
-	#ifdef __DEBUG_H__
-	cerr << "stage2 nargs: " << nargs << endl;
-	for ( int i = 0; args[i] != NULL; i += 1 ) {
-		cerr << args[i] << " ";
-	} // for
-	cerr << endl;
-	#endif // __DEBUG_H__
-
-	execvp( args[0], (char * const *)args );			// should not return
-	perror( "CFA Translator error: cpp level, execvp" );
-	exit( EXIT_FAILURE );								// tell gcc not to go any further
+	cerr << " " << cpp_in << endl;
+	#endif // __DEBUG_H__
+
+	if ( fork() == 0 ) {								// child runs CFA
+		args[0] = compiler_path.c_str();
+		args[nargs++] = "-S";							// only compile and put assembler output in specified file
+		if ( save_temps ) {								// make gcc accept .ifa suffix
+			args[nargs++] = "-x";
+			args[nargs++] = "cpp-output";
+		} // if
+		args[nargs++] = cfa_cpp_out.c_str();
+		args[nargs] = nullptr;							// terminate argument list
+
+		#ifdef __DEBUG_H__
+		cerr << "stage2 nargs: " << nargs << endl;
+		for ( int i = 0; args[i] != nullptr; i += 1 ) {
+			cerr << args[i] << " ";
+		} // for
+		cerr << endl;
+		#endif // __DEBUG_H__
+
+		execvp( args[0], (char * const *)args );		// should not return
+		perror( "CC1 Translator error: stage 2 cc1, execvp" );
+		cerr << " invoked " << cargs[0] << endl;
+		exit( EXIT_FAILURE );							// tell gcc not to go any further
+	} // if
+
+	wait( &code );										// wait for child to finish
+
+	if ( WIFSIGNALED(code) ) {							// child failed ?
+		rmtmpfile();									// remove tmpname
+		cerr << "CC1 Translator error: stage 2, child failed " << WTERMSIG(code) << endl;
+		exit( EXIT_FAILURE );
+	} // if
+
+	#ifdef __DEBUG_H__
+	cerr << "return code from gcc cc1:" << WEXITSTATUS(code) << endl;
+	#endif // __DEBUG_H__
+
+	rmtmpfile();										// remove tmpname
+	exit( WEXITSTATUS( code ) );						// stop regardless of success or failure
 } // Stage2
 
 
+// This program is called twice because of the -no-integrated-cpp. The calls are differentiated by the first
+// command-line argument. The first call replaces the traditional cpp pass to preprocess the C program. The second call
+// is to the compiler, which is broken into two steps: preprocess again with cfa-cpp and then call gcc to compile the
+// doubly preprocessed program.
+
 int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
 	#ifdef __DEBUG_H__
-	for ( int i = 0; env[i] != NULL; i += 1 ) {
+	for ( int i = 0; env[i] != nullptr; i += 1 ) {
 		cerr << env[i] << endl;
 	} // for
 	#endif // __DEBUG_H__
 
-	string arg = argv[1];
+	signal( SIGINT,  sigTermHandler );
+	signal( SIGTERM, sigTermHandler );
+
+	string arg( argv[1] );
 
 	// Currently, stage 1 starts with flag -E and stage 2 with flag -fpreprocessed.
Index: driver/cfa.cc
===================================================================
--- driver/cfa.cc	(revision 655c5fa432b0d3c06bbbd9fb099aa0f6212d9551)
+++ driver/cfa.cc	(revision 3ce24255d054a251d7984a394c027f5aa3ab40ca)
@@ -10,6 +10,6 @@
 // Created On       : Tue Aug 20 13:44:49 2002
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Aug 10 08:44:15 2019
-// Update Count     : 311
+// Last Modified On : Tue Aug 27 06:11:24 2019
+// Update Count     : 416
 //
 
@@ -28,5 +28,4 @@
 #include "config.h"										// configure info
 
-
 using std::cerr;
 using std::endl;
@@ -34,18 +33,26 @@
 using std::to_string;
 
-
 //#define __DEBUG_H__
 
 
-bool prefix( string arg, string pre ) {
+void Putenv( char * argv[], string arg ) {
+	static int flags = 0;								// environment variables must have unique names
+
+	if ( putenv( (char *)( *new string( string( "__CFA_FLAG" + to_string( flags++ ) + "__=" ) + arg ) ).c_str() ) ) {
+		cerr << argv[0] << " error, cannot set environment variable." << endl;
+		exit( EXIT_FAILURE );
+	} // if
+} // Putenv
+
+
+bool prefix( const string & arg, const string & pre ) {	// check if string has prefix
 	return arg.substr( 0, pre.size() ) == pre;
 } // prefix
 
-bool suffix( string arg ) {
+bool suffix( const string & arg ) {						// check if string has suffix
 	enum { NumSuffixes = 3 };
 	static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" };
-	//std::cerr << arg << std::endl;
+
 	size_t dot = arg.find_last_of( "." );
-	//std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
 	if ( dot == string::npos ) return false;
 	const string * end = suffixes + NumSuffixes;
@@ -54,33 +61,17 @@
 
 
-void shuffle( const char * args[], int S, int E, int N ) {
-	// S & E index 1 passed the end so adjust with -1
-	#ifdef __DEBUG_H__
-	cerr << "shuffle:" << S << " " << E << " " << N << endl;
-	#endif // __DEBUG_H__
-	for ( int j = E-1 + N; j > S-1 + N; j -=1 ) {
-		#ifdef __DEBUG_H__
-		cerr << "\t" << j << " " << j-N << endl;
-		#endif // __DEBUG_H__
-		args[j] = args[j-N];
-	} // for
-} // shuffle
-
-static inline bool dirExists( const string & path ) {
+static inline bool dirExists( const string & path ) {	// check if directory exists
     struct stat info;
-    if(stat( path.c_str(), &info ) != 0)
-        return false;
-    else if(info.st_mode & S_IFDIR)
-        return true;
-    else
-        return false;
-} //dirExists
-
-
+    if ( stat( path.c_str(), &info ) != 0 ) return false;
+	return (info.st_mode & S_IFDIR) != 0;
+} // dirExists
+
+
+#define xstr(s) str(s)
 #define str(s) #s
 
 int main( int argc, char * argv[] ) {
 	string Version( CFA_VERSION_LONG );					// current version number from CONFIG
-	string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) );
+	string Major( xstr( CFA_VERSION_MAJOR ) ), Minor( xstr( CFA_VERSION_MINOR ) ), Patch( xstr( CFA_VERSION_PATCH ) );
 
 	string installincdir( CFA_INCDIR );					// fixed location of include files
@@ -90,5 +81,5 @@
 	string heading;										// banner printed at start of cfa compilation
 	string arg;											// current command-line argument during command-line parsing
-	string Bprefix;										// path where gcc looks for compiler command steps
+	string bprefix;										// path where gcc looks for compiler steps
 	string langstd;										// language standard
 
@@ -97,6 +88,6 @@
 
 	bool x_flag = false;								// -x flag
-	bool nonoptarg = false;								// indicates non-option argument specified
-	bool link = true;									// linking as well as compiling
+	bool nonoptarg = false;								// no non-option arguments specified, i.e., no file names
+	bool link = true;									// link stage occurring
 	bool verbose = false;								// -v flag
 	bool quiet = false;									// -quiet flag
@@ -111,5 +102,6 @@
 	bool m32 = false;									// -m32 flag
 	bool m64 = false;									// -m64 flag
-	bool intree = false;
+	bool intree = false;								// build in tree
+	int o_file = 0;										// -o filename position
 
 	const char *args[argc + 100];						// cfa command line values, plus some space for additional flags
@@ -135,14 +127,12 @@
 
 			if ( arg == "-Xlinker" || arg == "-o" ) {
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass argument along
 				i += 1;
 				if ( i == argc ) continue;				// next argument available ?
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass argument along
+				if ( arg == "-o" ) o_file = i;			// remember file
 			} else if ( arg == "-XCFA" ) {				// CFA pass through
 				i += 1;
-				args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + argv[i] ) ).c_str();
-				nargs += 1;
+				Putenv( argv, argv[i] );
 
 				// CFA specific arguments
@@ -151,10 +141,9 @@
 				CFA_flag = true;						// strip the -CFA flag
 				link = false;
-				args[nargs] = "-E";						// replace the argument with -E
-				nargs += 1;
+				args[nargs++] = "-fsyntax-only";		// stop after stage 2
 			} else if ( arg == "-debug" ) {
 				debug = true;							// strip the debug flag
 			} else if ( arg == "-nodebug" ) {
-				debug = false;							// strip the debug flag
+				debug = false;							// strip the nodebug flag
 			} else if ( arg == "-nolib" ) {
 				nolib = true;							// strip the nodebug flag
@@ -176,8 +165,5 @@
 				if ( i == argc ) continue;				// next argument available ?
 				compiler_path = argv[i];
-				if ( putenv( (char *)( *new string( string( "__CFA_COMPILER__=" ) + argv[i]) ).c_str() ) != 0 ) {
-					cerr << argv[0] << " error, cannot set environment variable." << endl;
-					exit( EXIT_FAILURE );
-				} // if
+				Putenv( argv, arg + "=" + argv[i] );
 
 				// C specific arguments
@@ -185,20 +171,19 @@
 			} else if ( arg == "-v" ) {
 				verbose = true;							// verbosity required
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass argument along
 			} else if ( arg == "-g" ) {
 				debugging = true;						// symbolic debugging required
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass argument along
+			} else if ( arg == "-save-temps" ) {
+				args[nargs++] = argv[i];				// pass argument along
+				Putenv( argv, arg );					// save cfa-cpp output
 			} else if ( prefix( arg, "-x" ) ) {			// file suffix ?
 				string lang;
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass argument along
 				if ( arg.length() == 2 ) {				// separate argument ?
 					i += 1;
 					if ( i == argc ) continue;			// next argument available ?
 					lang = argv[i];
-					args[nargs] = argv[i];				// pass the argument along
-					nargs += 1;
+					args[nargs++] = argv[i];			// pass argument along
 				} else {
 					lang = arg.substr( 2 );
@@ -207,63 +192,25 @@
 			} else if ( prefix( arg, "-std=" ) || prefix( arg, "--std=" ) ) {
 				std_flag = true;						// -std=XX provided
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass argument along
 			} else if ( arg == "-w" ) {
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
-				args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass argument along
+				Putenv( argv, arg );
 			} else if ( prefix( arg, "-W" ) ) {			// check before next tests
 				if ( arg == "-Werror" || arg == "-Wall" ) {
-					args[nargs] = argv[i];				// pass the argument along
-					nargs += 1;
-					args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
-					nargs += 1;
+					args[nargs++] = argv[i];			// pass argument along
+					Putenv( argv, argv[i] );
 				} else {
 					unsigned int adv = prefix( arg, "-Wno-" ) ? 5 : 2;
-					args[nargs] = argv[i];				// conditionally pass the argument along
-					const char * warning = argv[i] + adv;	  // extract warning
+					args[nargs] = argv[i];				// conditionally pass argument along
+					const char * warning = argv[i] + adv; // extract warning
 					if ( SemanticWarning_Exist( warning ) ) { // replace the argument for cfa-cpp
-						args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str();
+						Putenv( argv, arg );
 					} // if
 					nargs += 1;
 				} // if
 			} else if ( prefix( arg, "-B" ) ) {
-				Bprefix = arg.substr(2);				// strip the -B flag
-				args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
-				nargs += 1;
-			} else if ( prefix( arg, "-b" ) ) {
-				if ( arg.length() == 2 ) {				// separate argument ?
-					i += 1;
-					if ( i == argc ) continue;			// next argument available ?
-					arg += argv[i];						// concatenate argument
-				} // if
-				// later versions of gcc require the -b option to appear at the start of the command line
-				shuffle( args, sargs, nargs, 1 );		// make room at front of argument list
-				args[sargs] = ( *new string( arg ) ).c_str(); // pass the argument along
-				if ( putenv( (char *)( *new string( string( "__GCC_MACHINE__=" ) + arg ) ).c_str() ) != 0 ) {
-					cerr << argv[0] << " error, cannot set environment variable." << endl;
-					exit( EXIT_FAILURE );
-				} // if
-				sargs += 1;
-				nargs += 1;
-			} else if ( prefix( arg, "-V" ) ) {
-				if ( arg.length() == 2 ) {				// separate argument ?
-					i += 1;
-					if ( i == argc ) continue;			// next argument available ?
-					arg += argv[i];						// concatenate argument
-				} // if
-				// later versions of gcc require the -V option to appear at the start of the command line
-				shuffle( args, sargs, nargs, 1 );		// make room at front of argument list
-				args[sargs] = ( *new string( arg ) ).c_str(); // pass the argument along
-				if ( putenv( (char *)( *new string( string( "__GCC_VERSION__=" ) + arg ) ).c_str() ) != 0 ) {
-					cerr << argv[0] << " error, cannot set environment variable." << endl;
-					exit( EXIT_FAILURE );
-				} // if
-				sargs += 1;
-				nargs += 1;
+				bprefix = arg.substr(2);				// strip the -B flag
 			} else if ( arg == "-c" || arg == "-S" || arg == "-E" || arg == "-M" || arg == "-MM" ) {
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
+				args[nargs++] = argv[i];				// pass argument along
 				if ( arg == "-E" || arg == "-M" || arg == "-MM" ) {
 					cpp_flag = true;					// cpp only
@@ -272,36 +219,27 @@
 			} else if ( arg[1] == 'l' ) {
 				// if the user specifies a library, load it after user code
-				libs[nlibs] = argv[i];
-				nlibs += 1;
+				libs[nlibs++] = argv[i];
 			} else if ( arg == "-m32" ) {
 				m32 = true;
 				m64 = false;
-				args[nargs] = argv[i];
-				nargs += 1;
+				args[nargs++] = argv[i];
 			} else if ( arg == "-m64" ) {
 				m64 = true;
 				m32 = false;
-				args[nargs] = argv[i];
-				nargs += 1;
+				args[nargs++] = argv[i];
 			} else {
 				// concatenate any other arguments
-				args[nargs] = argv[i];
-				nargs += 1;
+				args[nargs++] = argv[i];
 			} // if
 		} else {
 			bool cfa = suffix( arg );					// check suffix
 			if ( ! x_flag && cfa ) {					// no explicit suffix and cfa suffix ?
-				args[nargs] = "-x";
-				nargs += 1;
-				args[nargs] = "c";
-				nargs += 1;
+				args[nargs++] = "-x";
+				args[nargs++] = "c";
 			} // if
-			args[nargs] = argv[i];						// concatenate file
-			nargs += 1;
+			args[nargs++] = argv[i];					// concatenate files
 			if ( ! x_flag && cfa ) {					// no explicit suffix and cfa suffix ?
-				args[nargs] = "-x";
-				nargs += 1;
-				args[nargs] = "none";
-				nargs += 1;
+				args[nargs++] = "-x";
+				args[nargs++] = "none";
 			} // if
 			nonoptarg = true;
@@ -310,6 +248,5 @@
 
 	#ifdef __x86_64__
-	args[nargs] = "-mcx16";								// allow double-wide CAA
-	nargs += 1;
+	args[nargs++] = "-mcx16";							// allow double-wide CAA
 	#endif // __x86_64__
 
@@ -322,4 +259,5 @@
 	#endif // __DEBUG_H__
 
+	// -E flag stops at cc1 stage 1, so cfa-cpp in cc1 stage 2 is never executed.
 	if ( cpp_flag && CFA_flag ) {
 		cerr << argv[0] << " error, cannot use -E and -CFA flags together." << endl;
@@ -328,167 +266,114 @@
 
 	// add the CFA include-library paths, which allow direct access to header files without directory qualification
-	if( !intree ) {
-		args[nargs] = "-I" CFA_INCDIR;
-		nargs += 1;
+	if ( ! intree ) {
+		args[nargs++] = "-I" CFA_INCDIR;
 		if ( ! noincstd_flag ) {						// do not use during build
-			args[nargs] = "-I" CFA_INCDIR "stdhdr";
-			nargs += 1;
+			args[nargs++] = "-I" CFA_INCDIR "stdhdr";
 		} // if
-		args[nargs] = "-I" CFA_INCDIR "concurrency";
-		nargs += 1;
-		args[nargs] = "-I" CFA_INCDIR "containers";
-		nargs += 1;
-	} else {
-		args[nargs] = "-I" TOP_SRCDIR "libcfa/src";
-		nargs += 1;
+		args[nargs++] = "-I" CFA_INCDIR "concurrency";
+		args[nargs++] = "-I" CFA_INCDIR "containers";
+	} else {
+		args[nargs++] = "-I" TOP_SRCDIR "libcfa/src";
 		if ( ! noincstd_flag ) {						// do not use during build
-			args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
-			nargs += 1;
+			args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
 		} // if
-		args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
-		nargs += 1;
-		args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
-		nargs += 1;
-	}
+		args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
+		args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
+	} // if
 
 	// add stdbool to get defines for bool/true/false
-	args[nargs] = "-imacros";
-	nargs += 1;
-	args[nargs] = "stdbool.h";
-	nargs += 1;
+	args[nargs++] = "-imacros";
+	args[nargs++] = "stdbool.h";
 
 	string libbase;
-	if( !intree ) {
+	if ( ! intree ) {
 		libbase = CFA_LIBDIR;
 	} else {
 		libbase = TOP_BUILDDIR "libcfa/";
-		args[nargs] = "-D__CFA_FLAG__=-t";
-		nargs += 1;
-	}
-
-	string arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
+		Putenv( argv, "-t" );
+	} // if
+
+	string arch( m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU) );
 	if ( ! m32 && ! m64 ) {
 		if ( arch == "x86" ) {
-			args[nargs] = "-m32";
-			nargs += 1;
+			args[nargs++] = "-m32";
 		} else if ( arch == "x64" ) {
-			args[nargs] = "-m64";
-			nargs += 1;
+			args[nargs++] = "-m64";
 		}  // if
 	} // if
-	const char * config = nolib ? "nolib" : (debug ? "debug": "nodebug");
-	string libdir = libbase + arch + "-" + config;
-
-	if ( ! nolib && ! dirExists( libdir ) ) {
-		cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
-		cerr << "Was looking for " << libdir << endl;
-		libdir = libbase + arch + "-" + "nolib";
-	} // if
-
+
+	string libdir( libbase + arch + "-" + (nolib ? "nolib" : (debug ? "debug": "nodebug")) );
 	if ( ! dirExists( libdir ) ) {
-		cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
-		cerr << "Was looking for " << libdir << endl;
+		cerr << argv[0] << " internal error, cannot find prelude directory " << libdir << endl;
 		exit( EXIT_FAILURE );
 	} // if
 
-	args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir + (intree ? "/prelude" : "")) ).c_str();
-	nargs += 1;
-
 	for ( int i = 0; i < nlibs; i += 1 ) {				// copy non-user libraries after all user libraries
-		args[nargs] = libs[i];
-		nargs += 1;
+		args[nargs++] = libs[i];
 	} // for
 
 	if ( link ) {
-		args[nargs] = "-Xlinker";
-		nargs += 1;
-		args[nargs] = "--undefined=__cfaabi_dbg_bits_write";
-		nargs += 1;
-		args[nargs] = "-Xlinker";
-		nargs += 1;
-		args[nargs] = "--undefined=__cfaabi_interpose_startup";
-		nargs += 1;
-		args[nargs] = "-Xlinker";
-		nargs += 1;
-		args[nargs] = "--undefined=__cfaabi_appready_startup";
-		nargs += 1;
-
-		// include the cfa library in case it's needed
-		args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
-		nargs += 1;
-		args[nargs] = ( *new string( string("-Wl,-rpath," ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
-		nargs += 1;
-		args[nargs] = "-Wl,--push-state,--as-needed";
-		nargs += 1;
-		args[nargs] = "-lcfathread";
-		nargs += 1;
-		args[nargs] = "-Wl,--pop-state";
-		nargs += 1;
-		args[nargs] = "-lcfa";
-		nargs += 1;
-		args[nargs] = "-lpthread";
-		nargs += 1;
-		args[nargs] = "-ldl";
-		nargs += 1;
-		args[nargs] = "-lrt";
-		nargs += 1;
-		args[nargs] = "-lm";
-		nargs += 1;
-	} // if
-
-	// Add exception flags (unconditionally)
-	args[nargs] = "-fexceptions";
-	nargs += 1;
-
-	// add the correct set of flags based on the type of compile this is
-
-	args[nargs] = ( *new string( string("-D__CFA_MAJOR__=") + Major ) ).c_str();
-	nargs += 1;
-	args[nargs] = ( *new string( string("-D__CFA_MINOR__=") + Minor ) ).c_str();
-	nargs += 1;
-	args[nargs] = ( *new string( string("-D__CFA_PATCH__=") + Patch ) ).c_str();
-	nargs += 1;
-	args[nargs] = "-D__CFA__";
-	nargs += 1;
-	args[nargs] = "-D__CFORALL__";
-	nargs += 1;
-	args[nargs] = "-D__cforall";
-	nargs += 1;
+		args[nargs++] = "-Xlinker";
+		args[nargs++] = "--undefined=__cfaabi_dbg_bits_write";
+		args[nargs++] = "-Xlinker";
+		args[nargs++] = "--undefined=__cfaabi_interpose_startup";
+		args[nargs++] = "-Xlinker";
+		args[nargs++] = "--undefined=__cfaabi_appready_startup";
+
+		// include the cfa library in case it is needed
+		args[nargs++] = ( *new string( string("-L" ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
+		args[nargs++] = ( *new string( string("-Wl,-rpath," ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
+		args[nargs++] = "-Wl,--push-state,--as-needed";
+		args[nargs++] = "-lcfathread";
+		args[nargs++] = "-Wl,--pop-state";
+		args[nargs++] = "-lcfa";
+		args[nargs++] = "-lpthread";
+		args[nargs++] = "-ldl";
+		args[nargs++] = "-lrt";
+		args[nargs++] = "-lm";
+	} // if
+
+	args[nargs++] = "-fexceptions";						// add exception flags (unconditionally)
+
+	// add flags based on the type of compile
+
+	args[nargs++] = ( *new string( string("-D__CFA_MAJOR__=") + Major ) ).c_str();
+	args[nargs++] = ( *new string( string("-D__CFA_MINOR__=") + Minor ) ).c_str();
+	args[nargs++] = ( *new string( string("-D__CFA_PATCH__=") + Patch ) ).c_str();
+	args[nargs++] = "-D__CFA__";
+	args[nargs++] = "-D__CFORALL__";
+	args[nargs++] = "-D__cforall";
 
 	if ( cpp_flag ) {
-		args[nargs] = "-D__CPP__";
-		nargs += 1;
-	} // if
-
-	shuffle( args, sargs, nargs, 1 );					// make room at front of argument list
-	nargs += 1;
+		args[nargs++] = "-D__CPP__";
+	} // if
+
 	if ( CFA_flag ) {
-		args[sargs] = "-D__CFA_FLAG__=-N";
-		args[nargs] = "-D__CFA_PREPROCESS_";
-		nargs += 1;
-	} else {
-		args[sargs] = "-D__CFA_FLAG__=-L";
-	} // if
-	sargs += 1;
+		Putenv( argv, "-N" );
+		Putenv( argv, "-CFA" );
+		// -CFA implies cc1 stage 2, but gcc does not pass the -o file to this stage because it believe the file is for
+		// the linker. Hence, the -o file is explicit passed to cc1 stage 2 and used as cfa-cpp's output file.
+		if ( o_file ) Putenv( argv, string( "-o=" ) + argv[o_file] );
+	} else {
+		Putenv( argv, "-L" );
+	} // if
+
+	Putenv( argv, "--prelude-dir=" + libdir + (intree ? "/prelude" : "") );
 
 	if ( debug ) {
 		heading += " (debug)";
-		args[nargs] = "-D__CFA_DEBUG__";
-		nargs += 1;
+		args[nargs++] = "-D__CFA_DEBUG__";
 	} else {
 		heading += " (no debug)";
 	} // if
 
-	if ( Bprefix.length() == 0 ) {
-		Bprefix = ! intree ? installlibdir : srcdriverdir;
-		if ( Bprefix[Bprefix.length() - 1] != '/' ) Bprefix += '/';
-		args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
-		nargs += 1;
-	} // if
-
-	args[nargs] = "-Xlinker";							// used by backtrace
-	nargs += 1;
-	args[nargs] = "-export-dynamic";
-	nargs += 1;
+	if ( bprefix.length() == 0 ) {
+		bprefix = ! intree ? installlibdir : srcdriverdir;
+		if ( bprefix[bprefix.length() - 1] != '/' ) bprefix += '/';
+		Putenv( argv, ( *new string( string("-B=") + bprefix ) ).c_str() );
+	} // if
+
+	args[nargs++] = "-Xlinker";							// used by backtrace
+	args[nargs++] = "-export-dynamic";
 
 	// execute the compilation command
@@ -504,22 +389,15 @@
 
 	if ( prefix( compiler_name, "gcc" ) ) {				// allow suffix on gcc name
-		args[nargs] = "-no-integrated-cpp";
-		nargs += 1;
-		args[nargs] = "-Wno-deprecated";
-		nargs += 1;
-#ifdef HAVE_CAST_FUNCTION_TYPE
-		args[nargs] = "-Wno-cast-function-type";
-		nargs += 1;
-#endif // HAVE_CAST_FUNCTION_TYPE
+		args[nargs++] = "-no-integrated-cpp";
+		args[nargs++] = "-Wno-deprecated";
+		#ifdef HAVE_CAST_FUNCTION_TYPE
+		args[nargs++] = "-Wno-cast-function-type";
+		#endif // HAVE_CAST_FUNCTION_TYPE
 		if ( ! std_flag ) {								// default c11, if none specified
-			args[nargs] = "-std=gnu11";
-			nargs += 1;
+			args[nargs++] = "-std=gnu11";
 		} // if
-		args[nargs] = "-fgnu89-inline";
-		nargs += 1;
-		args[nargs] = "-D__int8_t_defined";				// prevent gcc type-size attributes
-		nargs += 1;
-		args[nargs] = ( *new string( string("-B") + Bprefix ) ).c_str();
-		nargs += 1;
+		args[nargs++] = "-fgnu89-inline";
+		args[nargs++] = "-D__int8_t_defined";			// prevent gcc type-size attributes
+		args[nargs++] = ( *new string( string("-B") + bprefix ) ).c_str();
 	} else {
 		cerr << argv[0] << " error, compiler \"" << compiler_name << "\" unsupported." << endl;
@@ -527,10 +405,10 @@
 	} // if
 
-	args[nargs] = NULL;									// terminate with NULL
+	args[nargs] = nullptr;								// terminate
 
 	#ifdef __DEBUG_H__
 	cerr << "nargs: " << nargs << endl;
 	cerr << "args:" << endl;
-	for ( int i = 0; args[i] != NULL; i += 1 ) {
+	for ( int i = 0; args[i] != nullptr; i += 1 ) {
 		cerr << " \"" << args[i] << "\"" << endl;
 	} // for
@@ -554,5 +432,5 @@
 		if ( argc == 2 ) exit( EXIT_SUCCESS );			// if only the -v flag is specified, do not invoke gcc
 
-		for ( int i = 0; args[i] != NULL; i += 1 ) {
+		for ( int i = 0; args[i] != nullptr; i += 1 ) {
 			cerr << args[i] << " ";
 		} // for
@@ -568,5 +446,5 @@
 
 	execvp( args[0], (char *const *)args );				// should not return
-	perror( "CFA Translator error: cfa level, execvp" );
+	perror( "CFA Translator error: execvp" );
 	exit( EXIT_FAILURE );
 } // main
Index: src/ResolvExpr/Unify.cc
===================================================================
--- src/ResolvExpr/Unify.cc	(revision 655c5fa432b0d3c06bbbd9fb099aa0f6212d9551)
+++ src/ResolvExpr/Unify.cc	(revision 3ce24255d054a251d7984a394c027f5aa3ab40ca)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Sun May 17 12:27:10 2015
-// Last Modified By : Aaron B. Moss
-// Last Modified On : Mon Jun 18 11:58:00 2018
-// Update Count     : 43
+// Last Modified By : Andrew Beach
+// Last Modified On : Wed Sep  4 10:00:00 2019
+// Update Count     : 44
 //
 
@@ -278,5 +278,5 @@
 #endif
 			if ( ( common = commonType( type1, type2, widen.first, widen.second, indexer, env, openVars ) ) ) {
-				common->get_qualifiers() = tq1 | tq2;
+				common->tq = tq1.unify( tq2 );
 #ifdef DEBUG
 				std::cerr << "unifyInexact: common type is ";
@@ -295,5 +295,5 @@
 				if ( ( tq1 > tq2 || widen.first ) && ( tq2 > tq1 || widen.second ) ) {
 					common = type1->clone();
-					common->get_qualifiers() = tq1 | tq2;
+					common->tq = tq1.unify( tq2 );
 					result = true;
 				} else {
@@ -302,5 +302,5 @@
 			} else {
 				common = type1->clone();
-				common->get_qualifiers() = tq1 | tq2;
+				common->tq = tq1.unify( tq2 );
 				result = true;
 			} // if
Index: src/SynTree/Expression.cc
===================================================================
--- src/SynTree/Expression.cc	(revision 655c5fa432b0d3c06bbbd9fb099aa0f6212d9551)
+++ src/SynTree/Expression.cc	(revision 3ce24255d054a251d7984a394c027f5aa3ab40ca)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Andrew Beach
-// Last Modified On : Tue Aug 13 11:31:00 2019
-// Update Count     : 63
+// Last Modified On : Thr Aug 15 13:43:00 2019
+// Update Count     : 64
 //
 
@@ -646,4 +646,7 @@
 		result = new VoidType( Type::Qualifiers() );
 	}
+}
+bool StmtExpr::get_lvalue() const {
+	return result->get_lvalue();
 }
 void StmtExpr::print( std::ostream & os, Indenter indent ) const {
Index: src/SynTree/Expression.h
===================================================================
--- src/SynTree/Expression.h	(revision 655c5fa432b0d3c06bbbd9fb099aa0f6212d9551)
+++ src/SynTree/Expression.h	(revision 3ce24255d054a251d7984a394c027f5aa3ab40ca)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Andrew Beach
-// Last Modified On : Wed Aug 14 14:24:00 2019
-// Update Count     : 53
+// Last Modified On : Thr Aug 15 13:46:00 2019
+// Update Count     : 54
 //
 
@@ -777,4 +777,6 @@
 	virtual ~StmtExpr();
 
+	bool get_lvalue() const final;
+
 	CompoundStmt * get_statements() const { return statements; }
 	StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }
Index: src/SynTree/Type.h
===================================================================
--- src/SynTree/Type.h	(revision 655c5fa432b0d3c06bbbd9fb099aa0f6212d9551)
+++ src/SynTree/Type.h	(revision 3ce24255d054a251d7984a394c027f5aa3ab40ca)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Feb 14 17:11:24 2019
-// Update Count     : 169
+// Last Modified By : Andrew Beach
+// Last Modified On : Wed Sep  4 09:58:00 2019
+// Update Count     : 170
 //
 
@@ -131,4 +131,10 @@
 	 	bool operator>( Qualifiers other ) const { return *this != other && *this >= other; }
 		BFCommon( Qualifiers, NumTypeQualifier )
+
+		Qualifiers unify( Qualifiers const & other ) const {
+			int or_flags = Mask & (val | other.val);
+			int and_flags = val & other.val;
+			return Qualifiers( or_flags | and_flags );
+		}
 	}; // Qualifiers
 
Index: src/main.cc
===================================================================
--- src/main.cc	(revision 655c5fa432b0d3c06bbbd9fb099aa0f6212d9551)
+++ src/main.cc	(revision 3ce24255d054a251d7984a394c027f5aa3ab40ca)
@@ -10,6 +10,6 @@
 // Created On       : Fri May 15 23:12:02 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun  5 20:35:13 2019
-// Update Count     : 601
+// Last Modified On : Fri Aug 23 06:50:08 2019
+// Update Count     : 607
 //
 
@@ -96,9 +96,9 @@
 DeclarationNode * parseTree = nullptr;					// program parse tree
 
-static bool waiting_for_gdb = false; // flag to set cfa-cpp to wait for gdb on start
+static bool waiting_for_gdb = false;					// flag to set cfa-cpp to wait for gdb on start
 
 static std::string PreludeDirector = "";
 
-static void parse_cmdline( int argc, char *argv[], const char *& filename );
+static void parse_cmdline( int argc, char *argv[] );
 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false );
 static void dump( list< Declaration * > & translationUnit, ostream & out = cout );
@@ -172,5 +172,4 @@
 	FILE * input;										// use FILE rather than istream because yyin is FILE
 	ostream * output = & cout;
-	const char * filename = nullptr;
 	list< Declaration * > translationUnit;
 
@@ -184,13 +183,13 @@
 	// } // for
 
-	parse_cmdline( argc, argv, filename );				// process command-line arguments
+	parse_cmdline( argc, argv );						// process command-line arguments
 	CodeGen::FixMain::setReplaceMain( !nomainp );
 
-	if(waiting_for_gdb) {
+	if ( waiting_for_gdb ) {
 		std::cerr << "Waiting for gdb" << std::endl;
 		std::cerr << "run :" << std::endl;
 		std::cerr << "  gdb attach " << getpid() << std::endl;
 		raise(SIGSTOP);
-	}
+	} // if
 
 	try {
@@ -198,16 +197,8 @@
 		if ( optind < argc ) {							// any commands after the flags ? => input file name
 			input = fopen( argv[ optind ], "r" );
-			assertf( input, "cannot open %s\n", argv[ optind ] );
-			// if running cfa-cpp directly, might forget to pass -F option (and really shouldn't have to)
-			if ( filename == nullptr ) filename = argv[ optind ];
-			// prelude filename comes in differently
-			if ( libcfap ) filename = "prelude.cfa";
+			assertf( input, "cannot open %s because %s\n", argv[ optind ], strerror( errno ) );
 			optind += 1;
 		} else {										// no input file name
 			input = stdin;
-			std::cerr << "Input from stdin" << std::endl;
-			// if running cfa-cpp directly, might forget to pass -F option. Since this takes from stdin, pass
-			// a fake name along
-			if ( filename == nullptr ) filename = "stdin";
 		} // if
 
@@ -447,5 +438,5 @@
 
 
-static const char optstring[] = ":hlLmNnpP:S:tgwW:D:F:";
+static const char optstring[] = ":hlLmNnpP:S:twW:D:";
 
 enum { PreludeDir = 128 };
@@ -466,5 +457,4 @@
 	{ "", no_argument, nullptr, 0 },					// -W
 	{ "", no_argument, nullptr, 0 },					// -D
-	{ "", no_argument, nullptr, 0 },					// -F
 	{ nullptr, 0, nullptr, 0 }
 }; // long_opts
@@ -486,5 +476,4 @@
 	"",													// -W
 	"",													// -D
-	"",													// -F
 }; // description
 
@@ -521,5 +510,5 @@
 
 static void usage( char *argv[] ) {
-    cout << "Usage: " << argv[0] << " options are:" << endl;
+    cout << "Usage: " << argv[0] << " [options] [input-file (default stdin)] [output-file (default stdout)], where options are:" << endl;
 	int i = 0, j = 1;									// j skips starting colon
 	for ( ; long_opts[i].name != 0 && optstring[j] != '\0'; i += 1, j += 1 ) {
@@ -547,5 +536,5 @@
 } // usage
 
-static void parse_cmdline( int argc, char * argv[], const char *& filename ) {
+static void parse_cmdline( int argc, char * argv[] ) {
 	opterr = 0;											// (global) prevent getopt from printing error messages
 
@@ -621,7 +610,4 @@
 		  case 'D':										// ignore -Dxxx, forwarded by cpp, hidden
 			break;
-		  case 'F':										// source file-name without suffix, hidden
-			filename = optarg;
-			break;
 		  case '?':										// unknown option
 			if ( optopt ) {								// short option ?
