Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic errors in mk_cheby.c introduced by commit r631 #185

Open
griffithJ opened this issue Sep 14, 2012 · 0 comments
Open

Logic errors in mk_cheby.c introduced by commit r631 #185

griffithJ opened this issue Sep 14, 2012 · 0 comments

Comments

@griffithJ
Copy link

In r631, in four places in mk_cheby.c, the single statement in a "for" loop was split into two statements, but no curly braces were added. As a result the second half is only executed once after the loop exits, not for every iteration as the original code did. For example:

                                for (i = 0; i < nru; ++i) /* store coefficient rows for u */
-                                       if (Ts->cu[i].m = ncu[i])
+                                       Ts->cu[i].m = ncu[i];
+                                       if (Ts->cu[i].m)
                                                if ((p = Ts->cu[i].c =
                                                                (double *)pj_malloc(sizeof(double) * ncu[i])))
                                                        for (j = 0; j < ncu[i]; ++j)

Xcode 4.4 and later complains about dangling "else" statements so adding the missing curly braces fixes that warning as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant