Skip to content

Suspicious code triggers warnings #16

Open
@bavay

Description

@bavay

When enabling much more warnings, I get the following (with gcc version 11.4.0 and Apple clang 12.0.0):

  • erfunc.c: warning: floating constant truncated to zero [-Woverflow] for lines 333 and 340
    • line 333 -> } else if( x < 1.0e-100 && x > 1.0e-1000 ) {
    • line 340 -> } else if (x <= 1.0e-1000) {
    • Are such comparisons required for some architectures that can handle such numbers? (the minimum value for a float is 2^31 - 1)
  • ctsa.h: warning: ISO C++ forbids zero-size array ‘params’ for lines 119, 146, 179, 199
    • all lines have the following: -> double params[0];
    • Is it something that should be replaced by a simple double? Or by double params[] ?
    • Fixed with commit 80c4be6
  • warning: self-comparison always evaluates to true
    • at seastest.c:673 "if (fit->rank != fit->p && fit->rank == fit->rank)" I think this one can safely be removed (no way it would evaluate to false
    • at autoutils.c: line 131 "if (dodiff != dodiff) return d;" and line 155 "if (dodiff != dodiff)". From my point of view, it would only evaluate to false if they are undefined (underflow, overflow...). I'm not even sure this could be possible for integers and I doubt this is the goal of these lines...
  • non-void function does not return a value
    • at boxcox.c:68 Here I have no suggestions on how to fix it. Is the function even called anywhere?

2024-12-03: I have edited this issues to add more warnings as well as checkboxes so what has been addressed is marked as such

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions