1. translation error
- Posted by PtitChaud Sep 07, 2010
- 1128 views
Hello,
I've just tried to use Eub4 (r3379) on win32 system.
Use the interpreted version of my project is OK, so I've tried to compile my big euphoria project with the euc tool and i obtain this error :
Clib.c(15): Error! E1014: Left operand must be an 'lvalue' Clib.c(21): Error! E1014: Left operand must be an 'lvalue'
The C source file Clib.c come from Clib.e and the function in error is make_word.
------------------------------------------------ global function make_word( integer lo, integer hi) ------------------------------------------------ -- syntax: i = make_word( lo, hi ) -- description: -- make 2 bytes (8bit) into a word (16bit) -- mask values ( copied from Derek Parnell's tk_math.e ) lo = and_bits( lo, #FF ) hi = and_bits( hi, #FF ) return hi*#100 + lo end function
I've done this test : make a small program which use the make_word function from Clib.e, translate it with euc tool. No compilation error. The executable is OK.
I've compare the two sources and found that :
In my project case, the make_word function in the produced source file lose the parameters to calculate the tu variable
In the test case, the produced source code seems to be OK and the program produce the good result.
BELOW the begining of the 2 Clic.c files produced by the euc process :
C source Clib.c from my big project begin by that code :
// Euphoria To C version 4.0.0 development (r3379) #include "include/euphoria.h" #include "main-.h" int _40make_word(int _lo_20237, int _hi_20238) { int _10768 = 0; int _10767 = 0; int _0, _1, _2; /** lo = and_bits( lo, #FF )*/ {unsigned long tu; tu = (unsigned long)2 & (unsigned long)255; 2 = MAKE_UINT(tu); } /** hi = and_bits( hi, #FF )*/ {unsigned long tu; tu = (unsigned long)2 & (unsigned long)255; 2 = MAKE_UINT(tu); } /** return hi*#100 + lo*/ if (_hi_20238 == (short)_hi_20238) _10767 = _hi_20238 * 256; else _10767 = NewDouble(_hi_20238 * (double)256); if (IS_ATOM_INT(_10767)) { _10768 = _10767 + _lo_20237; if ((long)((unsigned long)_10768 + (unsigned long)HIGH_BITS) >= 0) _10768 = NewDouble((double)_10768); }
C source Clib.c from my test begin by that code :
// Euphoria To C version 4.0.0 development (r3379) #include "include/euphoria.h" #include "main-.h" int _6make_word(int _lo_991, int _hi_992) { int _435 = 0; int _434 = 0; int _0, _1, _2; /** lo = and_bits( lo, #FF )*/ {unsigned long tu; tu = (unsigned long)_lo_991 & (unsigned long)255; _lo_991 = MAKE_UINT(tu); } /** hi = and_bits( hi, #FF )*/ {unsigned long tu; tu = (unsigned long)_hi_992 & (unsigned long)255; _hi_992 = MAKE_UINT(tu); } /** return hi*#100 + lo*/ if (_hi_992 == (short)_hi_992) _434 = _hi_992 * 256; else _434 = NewDouble(_hi_992 * (double)256); if (IS_ATOM_INT(_434)) { _435 = _434 + _lo_991; if ((long)((unsigned long)_435 + (unsigned long)HIGH_BITS) >= 0) _435 = NewDouble((double)_435); }
2. Re: translation error
- Posted by euphoric (admin) Sep 07, 2010
- 1099 views
I'm using r3403 and getting the error when trying to compile a Win32Lib program.
3. Re: translation error
- Posted by DerekParnell (admin) Sep 07, 2010
- 1134 views
Hello,
I've just tried to use Eub4 (r3379) on win32 system.
Use the interpreted version of my project is OK, so I've tried to compile my big euphoria project with the euc tool and i obtain this error :
Clib.c(15): Error! E1014: Left operand must be an 'lvalue' Clib.c(21): Error! E1014: Left operand must be an 'lvalue'
As a work around for now, change the make_word() function to this ...
------------------------------------------------ global function make_word( integer lo, integer hi) ------------------------------------------------ -- syntax: i = make_word( lo, hi ) -- description: -- make 2 bytes (8bit) into a word (16bit) integer l,h -- mask values ( copied from Derek Parnell's tk_math.e ) l = and_bits( lo, #FF ) h = and_bits( hi, #FF ) return h*#100 + l end function
4. Re: translation error
- Posted by mattlewis (admin) Sep 08, 2010
- 1088 views
I've just tried to use Eub4 (r3379) on win32 system.
Use the interpreted version of my project is OK, so I've tried to compile my big euphoria project with the euc tool and i obtain this error :
Clib.c(15): Error! E1014: Left operand must be an 'lvalue' Clib.c(21): Error! E1014: Left operand must be an 'lvalue'
This issue has been logged as ticket:201. Basically, the translator tries to replace variable values whenever it can with literal values. In this case, it is doing so to the LHS part of an expression, which it obviously shouldn't be doing.
Matt
5. Re: translation error
- Posted by PtitChaud Sep 08, 2010
- 1049 views
Thank's for our answer.
I've applied your recommendations and recompiled my euphoria program. Sames errors on other librairies like win32lib.ew or eugrid.e :
Win32Lib.c(88792): Error! E1014: Left operand must be an 'lvalue' Win32Lib.c(91715): Error! E1014: Left operand must be an 'lvalue'
or
eugrid.c(447): Error! E1014: Left operand must be an 'lvalue'
Always the same problem with functions using bitwise operations.
So, i've replaced the function call by the coding of the function or modified the coding to use local integer.
Now, the compiled and linked program is running and i hope, it will be OK.
Thank's for Euphoria guys and their (very) good jobs.