Fix some implicit typecasts (causes 64bit portability issues)
Reported by Atri Bhattacharya
scilab-build-compiler-warnings.log.tar.gz (738.88 KB, application/x-gzip)
Compilation warnings (compressed because of size)
BUG DESCRIPTION:
----------------
When building scilab the compiler warns of the following warnings:
[ 287s] src/c/stack2.c: In function 'get_optionals':
[ 287s] src/c/stack2.c:399:21: warning: passing argument 2 of 'getrhsvar_' makes pointer from integer without a cast [enabled by default]
[ 287s] GetRhsVar(ro->iPos, ro->iType, &ro->iRows, &ro->iCols, &ro->piAddr);
[ 287s] ^
[ 287s] In file included from ../../modules/core/includes/stack-def.h:16:0,
[ 287s] from ../../modules/core/includes/stack-c.h:34,
[ 287s] from src/c/stack2.c:34:
[ 287s] ../../modules/core/includes/stack2.h:163:9: note: expected 'char *' but argument is of type 'int'
[ 287s] int C2F(getrhsvar)(int *number, char *type__, int *m, int *n, int *lr, unsigned long type_len);
[ 287s] ^
[ 287s] ../../modules/core/includes/machine.h:10:19: note: in definition of macro 'C2F'
[ 287s] #define C2F(name) name##_
[ 287s] ^
...
[ 647s] src/c/scicos.c:2798:9: warning: passing argument 2 of 'DAESetMaxNumSteps' makes pointer from integer without a cast [enabled by default]
[ 647s] flag = DAESetMaxNumSteps(dae_mem, maxnh);
[ 647s] ^
[ 647s] src/c/scicos.c:2798:9: note: expected 'int *' but argument is of type 'int'
ERROR LOG:
----------
Full compile log attached.
HOW TO REPRODUCE THE BUG:
-------------------------
Default compilation of scilab-5.5.0-beta1.
OTHER INFORMATION:
------------------
I used the following patch to correct the problem:
Patch begins
-------------------------------------------------------------------
Index: scilab-5.5.0-beta-1/modules/scicos/src/c/scicos.c
===================================================================
--- scilab-5.5.0-beta-1.orig/modules/scicos/src/c/scicos.c
+++ scilab-5.5.0-beta-1/modules/scicos/src/c/scicos.c
@@ -2795,7 +2795,7 @@ static void cossimdaskr(double *told)
/* setting the maximum number of steps in an integration interval */
maxnh = 2000;
- flag = DAESetMaxNumSteps(dae_mem, maxnh);
+ flag = DAESetMaxNumSteps(dae_mem, &maxnh);
if (check_flag(&flag, "IDASetMaxNumSteps", 1))
{
*ierr = 200 + (-flag);
Index: scilab-5.5.0-beta-1/modules/core/src/c/stack2.c
===================================================================
--- scilab-5.5.0-beta-1.orig/modules/core/src/c/stack2.c
+++ scilab-5.5.0-beta-1/modules/core/src/c/stack2.c
@@ -396,7 +396,7 @@ int get_optionals(char *fname, rhs_opts
ro->iPos = k;
if (ro->iType != '?')
{
- GetRhsVar(ro->iPos, ro->iType, &ro->iRows, &ro->iCols, &ro->piAddr);
+ GetRhsVar(ro->iPos, ro->pstName, &ro->iRows, &ro->iCols, &ro->piAddr);
}
}
else
-------------------------------------------------------------------
Patch ends
Please let me know if I am doing the right thing.
Thanks a lot.