I have ~16k lines of 1998 vintage C code (~50 main progs) which built flawlessly under gcc at that time but now fails with many "lvalue required as left operand of assignment" errors in the first routine, "stutter.c". I'm not enough of a C programmer to find the problem and can't seem to search out an answer on the internet specific to my problem (with this rather generic error message).
Here are the specifics:
Compile line from the (vintage) Makefile:
gcc -O3 -Wall -D__dest_os=unix -I/usr/X11/include -DPLOTX11 -c -o stutter.o ../src/stutter.c
Failing statement examples:
cell_car(cell) = free_list;
cell_type(cell) = type;
cell_name(atom) = strdup(name);
cell_cdr(list) = binding_list;
cell_cdr(cell_car(current)) = b;
... (and many similar)
preceded by:
typedef enum CELL_ENUM {
CELL_LAMBDA, CELL_SFUNC, CELL_VFUNC, CELL_LIST, CELL_ATOM
} CELL_TYPE;
typedef struct CELL_STRUCT {
void *car, *cdr;
unsigned type : 7;
unsigned mark : 1;
char empty[3];
} CELL;
and:
#define cell_car(c) ((CELL *)(c)->car)
#define cell_cdr(c) ((CELL *)(c)->cdr)
#define cell_name(c) ((char *)(c)->car)
#define cell_func(c) ((CELL *(*)())(c)->car)
#define cell_type(c) ((CELL_TYPE)(c)->type)
#define cell_mark(c) ((c)->mark)
More code particulars available if needed. Is there some obvious deprecated feature here which explains this error??
I have many years of experience as a scientific Fortran programmer but retired before learning enough of C to completely make the switch. Haven't found anything helpful about legacy code at http://gcc.gnu.org/bugs/. I'd appreciate any help that would save me having to complete my C, C++ and gcc education before I get these routines working under linux for my current project. Thanks much!
free_list
... @sambledsoe, can you try to compile with clang instead of gcc in case you would get more informative error messages? – Pelargonium(some_variable) = 123
? Because that's what you're doing here. – Ordovicianfree_list
is, the macro can't be on the lhs of an assignment. – Labannahcar
(contents of the address register) andcdr
(contents of the data register). Hmmm - I smell Lisp. – Heim