Opened 4 months ago

Last modified 4 months ago

#62341 assigned defect

hdf4: macOS arm64 version produces wrong results

Reported by: svniemeijer (Sander Niemeijer) Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: hdf4

Description

When running the following program against any of the files from https://nsidc.org/data/NISE

#include <assert.h>
#include <stdio.h>
#include "hdf.h"
#include "mfhdf.h"

int main(int argc, char *argv[])
{
    int32 sd_id, sds_id, rank, dimsizes[H4_MAX_VAR_DIMS], data_type, num_attributes, i;
    char sds_name[H4_MAX_NC_NAME + 1];
    int result;

    sd_id = SDstart("NISE_SSMISF18_20210111.HDFEOS", DFACC_READ);
    sds_id = SDselect(sd_id, 0);
    result = SDgetinfo(sds_id, sds_name, &rank, dimsizes, &data_type, &num_attributes);
    assert(result == 0);
    for (i = 0; i < rank; i++)
    {
        printf("%d\n", dimsizes[i]);
    }
    return 0;
}

On x86_64 this gives 721 (twice). But on arm64 it gives -788398080 (twice).

The data is rank 2, 721 x 721. So the x86_64 output is correct.

It looks like the arm64 build of HDF4 is incorrectly treating the platform as big endian.

Change History (2)

comment:1 Changed 4 months ago by mf2k (Frank Schima)

In the future, please fill in the Port field and add the port maintainer(s) to Cc (port info --maintainers hdf4), if any.

comment:2 Changed 4 months ago by mf2k (Frank Schima)

Owner: set to tenomoto
Port: hdf4 added
Status: newassigned
Summary: macOS arm64 version of hdf4 produces wrong resultshdf4: macOS arm64 version produces wrong results
Note: See TracTickets for help on using tickets.