Skip to content

Possible use of uninitialized value GHz #4

@DYH-Hong

Description

@DYH-Hong

I tried to build this project using clang++ and it reported some errors different from GCC.

In Line 149, I think we should use MHz, since GHz is not initialized in this branch.

palmtree/CycleTimer.h

Lines 145 to 151 in e4fb5d0

} else if (MHz_str) {
*MHz_str = '\0';
if (1 == sscanf(after_at, "%f", &MHz)) {
//printf("MHz = %f\n", MHz);
secondsPerTick_val = 1e-6f / GHz;
break;
}

Reference: Line 156

palmtree/CycleTimer.h

Lines 154 to 158 in e4fb5d0

} else if (1 == sscanf(input, "cpu MHz : %f", &MHz)) {
//printf("MHz = %f\n", MHz);
secondsPerTick_val = 1e-6f / MHz;
break;
}

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