# spglib-2.5.0-1.20250130025742515814.develop.54.g1624219

## List of Findings

    Error: COMPILER_WARNING (CWE-563): [#def1]
    spglib-2.5.0-build/spglib-2.5.0/python/_spglib.c:446:19: warning[-Wunused-variable]: unused variable ‘len_list’
    #  446 |     int num_atom, len_list;
    #      |                   ^~~~~~~~
    #  444|       double(*lat)[3];
    #  445|       double(*pos)[3];
    #  446|->     int num_atom, len_list;
    #  447|       int *typat;
    #  448|       SpglibDataset *dataset;

    Error: COMPILER_WARNING (CWE-477): [#def2]
    spglib-2.5.0-build/spglib-2.5.0/python/_spglib.c: scope_hint: In function ‘py_get_layerdataset’
    spglib-2.5.0-build/spglib-2.5.0/python/_spglib.c:475:5: warning[-Wdeprecated-declarations]: ‘spg_get_layer_dataset’ is deprecated: Experimental interface. May be removed in next major release.
    spglib-2.5.0-build/spglib-2.5.0/python/_spglib.c:39: included_from: Included from here.
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:242:24: note: declared here
    #  473|       typat = (int *)PyArray_DATA(py_atom_types);
    #  474|
    #  475|->     dataset = spg_get_layer_dataset(lat, pos, typat, num_atom, aperiodic_dir,
    #  476|                                       symprec);
    #  477|

    Error: COMPILER_WARNING (CWE-477): [#def3]
    spglib-2.5.0-build/spglib-2.5.0/python/_spglib.c: scope_hint: In function ‘py_get_symmetry’
    spglib-2.5.0-build/spglib-2.5.0/python/_spglib.c:1080:5: warning[-Wdeprecated-declarations]: ‘spgat_get_symmetry’ is deprecated: Use the variables from SpglibDataset (rotations, translations)
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:284:13: note: declared here
    # 1078|
    # 1079|       /* num_sym has to be larger than num_sym_from_array_size. */
    # 1080|->     num_sym = spgat_get_symmetry(rot, trans, num_sym_from_array_size, lat, pos,
    # 1081|                                    types, num_atom, symprec, angle_tolerance);
    # 1082|       return PyLong_FromLong((long)num_sym);

    Error: COMPILER_WARNING (CWE-477): [#def4]
    spglib-2.5.0-build/spglib-2.5.0/python/_spglib.c: scope_hint: In function ‘py_get_hall_number_from_symmetry’
    spglib-2.5.0-build/spglib-2.5.0/python/_spglib.c:1491:9: warning[-Wdeprecated-declarations]: ‘spg_get_hall_number_from_symmetry’ is deprecated: Use the variable from SpglibSpacegroupType instead (hall_number)
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:357:13: note: declared here
    # 1489|
    # 1490|       hall_number =
    # 1491|->         spg_get_hall_number_from_symmetry(rot, trans, num_sym, symprec);
    # 1492|
    # 1493|       return PyLong_FromLong((long)hall_number);

    Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c: scope_hint: In function ‘main’
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:205:31: warning[-Wanalyzer-null-argument]: use of NULL ‘arg’ where non-null expected
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
    <built-in>: note: argument 2 of ‘__builtin_strstr’ must be non-null
    #  203|     for (i = 0; i < NumTests && testToRun == -1; ++i) {
    #  204|       char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
    #  205|->     if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
    #  206|         testToRun = i;
    #  207|         ac -= 2;

    Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:205:31: warning[-Wanalyzer-null-argument]: use of NULL ‘lowercase(cmakeGeneratedFunctionMapEntries[i].name)’ where non-null expected
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
    <built-in>: note: argument 1 of ‘__builtin_strstr’ must be non-null
    #  203|     for (i = 0; i < NumTests && testToRun == -1; ++i) {
    #  204|       char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
    #  205|->     if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
    #  206|         testToRun = i;
    #  207|         ac -= 2;

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def7]
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:205:31: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:4: included_from: Included from here.
    /usr/include/string.h:350:14: note: argument 1 of ‘strstr’ must be a pointer to a null-terminated string
    #  203|     for (i = 0; i < NumTests && testToRun == -1; ++i) {
    #  204|       char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
    #  205|->     if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
    #  206|         testToRun = i;
    #  207|         ac -= 2;

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def8]
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:205:31: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*arg’
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
    /usr/include/string.h:350:14: note: argument 2 of ‘strstr’ must be a pointer to a null-terminated string
    #  203|     for (i = 0; i < NumTests && testToRun == -1; ++i) {
    #  204|       char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
    #  205|->     if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
    #  206|         testToRun = i;
    #  207|         ac -= 2;

    Error: GCC_ANALYZER_WARNING (CWE-688): [#def9]
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:209:38: warning[-Wanalyzer-null-argument]: use of NULL ‘arg’ where non-null expected
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
    /usr/include/string.h:156:12: note: argument 2 of ‘strcmp’ must be non-null
    #  207|         ac -= 2;
    #  208|         av += 2;
    #  209|->     } else if (partial_match == 0 && strcmp(test_name, arg) == 0) {
    #  210|         testToRun = i;
    #  211|         ac--;

    Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:209:38: warning[-Wanalyzer-null-argument]: use of NULL ‘lowercase(cmakeGeneratedFunctionMapEntries[i].name)’ where non-null expected
    spglib-2.5.0-build/spglib-2.5.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
    /usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
    #  207|         ac -= 2;
    #  208|         av += 2;
    #  209|->     } else if (partial_match == 0 && strcmp(test_name, arg) == 0) {
    #  210|         testToRun = i;
    #  211|         ac--;

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def11]
    spglib-2.5.0-build/spglib-2.5.0/src/cell.c: scope_hint: In function ‘cel_free_cell’
    spglib-2.5.0-build/spglib-2.5.0/src/cell.c:125:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*cell.position’
    #  123|               cell->lattice = NULL;
    #  124|           }
    #  125|->         if (cell->position != NULL) {
    #  126|               free(cell->position);
    #  127|               cell->position = NULL;

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def12]
    spglib-2.5.0-build/spglib-2.5.0/src/cell.c:133:18: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*cell.tensor_rank’
    #  131|               cell->types = NULL;
    #  132|           }
    #  133|->         if ((cell->tensor_rank != NOSPIN) && (cell->tensors != NULL)) {
    #  134|               // When cell->tensor_rank==NOSPIN, cell->tensors is already
    #  135|               // NULL.

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def13]
    spglib-2.5.0-build/spglib-2.5.0/src/cell.c:133:51: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*cell.tensors’
    #  131|               cell->types = NULL;
    #  132|           }
    #  133|->         if ((cell->tensor_rank != NOSPIN) && (cell->tensors != NULL)) {
    #  134|               // When cell->tensor_rank==NOSPIN, cell->tensors is already
    #  135|               // NULL.

    Error: CPPCHECK_WARNING (CWE-457): [#def14]
    spglib-2.5.0-build/spglib-2.5.0/src/delaunay.c:125: warning[uninitvar]: Uninitialized variable: succeeded
    #  123|       }
    #  124|
    #  125|->     if (!succeeded) {
    #  126|           goto err;
    #  127|       }

    Error: CPPCHECK_WARNING (CWE-457): [#def15]
    spglib-2.5.0-build/spglib-2.5.0/src/delaunay.c:418: warning[uninitvar]: Uninitialized variable: succeeded
    #  416|       }
    #  417|
    #  418|->     if (!succeeded) {
    #  419|           goto err;
    #  420|       }

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
    spglib-2.5.0-build/spglib-2.5.0/src/kpoint.c: scope_hint: In function ‘get_point_group_reciprocal_with_q’
    spglib-2.5.0-build/spglib-2.5.0/src/kpoint.c:388:61: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘rot_reciprocal’
    #  386|       num_rot = 0;
    #  387|
    #  388|->     if ((ir_rot = (int *)malloc(sizeof(int) * rot_reciprocal->size)) == NULL) {
    #  389|           warning_memory("ir_rot");
    #  390|           return NULL;

    Error: CPPCHECK_WARNING (CWE-457): [#def17]
    spglib-2.5.0-build/spglib-2.5.0/src/niggli.c:135: error[uninitvar]: Uninitialized variable: p
    #  133|       int succeeded;
    #  134|       NiggliParams *p;
    #  135|->     int (*steps[8])(NiggliParams *p) = {step1, step2, step3, step4,
    #  136|                                           step5, step6, step7, step8};
    #  137|

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
    spglib-2.5.0-build/spglib-2.5.0/src/niggli.c: scope_hint: In function ‘get_metric’
    spglib-2.5.0-build/spglib-2.5.0/src/niggli.c:515:34: warning[-Wanalyzer-malloc-leak]: leak of ‘get_transpose(M)’
    #  513|       for (i = 0; i < 3; i++) {
    #  514|           for (j = 0; j < 3; j++) {
    #  515|->             M_T[i * 3 + j] = M[j * 3 + i];
    #  516|           }
    #  517|       }

    Error: GCC_ANALYZER_WARNING (CWE-131): [#def19]
    spglib-2.5.0-build/spglib-2.5.0/src/overlap.c: scope_hint: In function ‘overlap_checker_alloc’
    spglib-2.5.0-build/spglib-2.5.0/src/overlap.c:530:25: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
    #  528|       /* so a 'char *' is used. */
    #  529|       chr_blob = (char *)checker->blob;
    #  530|->     checker->pos_temp_1 = (double(*)[3])(chr_blob + offset_pos_temp_1);
    #  531|       checker->pos_temp_2 = (double(*)[3])(chr_blob + offset_pos_temp_2);
    #  532|       checker->distance_temp = (double *)(chr_blob + offset_distance_temp);

    Error: CPPCHECK_WARNING (CWE-457): [#def20]
    spglib-2.5.0-build/spglib-2.5.0/src/pointgroup.c:408: warning[uninitvar]: Uninitialized variables: pointgroup.holohedry, pointgroup.laue
    #  406|       }
    #  407|
    #  408|->     return pointgroup;
    #  409|   }
    #  410|

    Error: COMPILER_WARNING (CWE-457): [#def21]
    spglib-2.5.0-build/spglib-2.5.0/src/pointgroup.c:752:22: warning[-Wmaybe-uninitialized]: ‘axes’ may be used uninitialized
    #  752 |     if (rot_axes[axes[0]][aperiodic_axis] == 1 ||
    #      |                  ~~~~^~~
    spglib-2.5.0-build/spglib-2.5.0/src/pointgroup.c: scope_hint: In function ‘ptg_get_transformation_matrix’
    spglib-2.5.0-build/spglib-2.5.0/src/pointgroup.c:382:9: note: ‘axes’ declared here
    #  382 |     int axes[3];
    #      |         ^~~~
    #  750|       }
    #  751|
    #  752|->     if (rot_axes[axes[0]][aperiodic_axis] == 1 ||
    #  753|           rot_axes[axes[0]][aperiodic_axis] == -1) {
    #  754|           /* For Monoclinic/Oblique. */

    Error: COMPILER_WARNING (CWE-457): [#def22]
    spglib-2.5.0-build/spglib-2.5.0/src/pointgroup.c:1038:46: warning[-Wmaybe-uninitialized]: ‘axes’ may be used uninitialized
    # 1038 |             tmat[i][j] = s[j] * rot_axes[axes[j] % NUM_ROT_AXES][i];
    #      |                                          ~~~~^~~
    spglib-2.5.0-build/spglib-2.5.0/src/pointgroup.c: scope_hint: In function ‘ptg_get_transformation_matrix’
    spglib-2.5.0-build/spglib-2.5.0/src/pointgroup.c:382:9: note: ‘axes’ declared here
    #  382 |     int axes[3];
    #      |         ^~~~
    # 1036|       for (i = 0; i < 3; i++) {
    # 1037|           for (j = 0; j < 3; j++) {
    # 1038|->             tmat[i][j] = s[j] * rot_axes[axes[j] % NUM_ROT_AXES][i];
    # 1039|           }
    # 1040|       }

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def23]
    spglib-2.5.0-build/spglib-2.5.0/src/primitive.c: scope_hint: In function ‘get_primitive_in_translation_space’
    spglib-2.5.0-build/spglib-2.5.0/src/primitive.c:686:18: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
    #  684|       cell = NULL;
    #  685|
    #  686|->     if (primitive->cell->size != 1) {
    #  687|           prm_free_primitive(primitive);
    #  688|           primitive = NULL;

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def24]
    spglib-2.5.0-build/spglib-2.5.0/src/site_symmetry.c: scope_hint: In function ‘set_Wyckoffs_labels’
    spglib-2.5.0-build/spglib-2.5.0/src/site_symmetry.c:372:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘nums_equiv_atoms’
    #  370|       nums_equiv_atoms = (int *)malloc(sizeof(int) * conv_prim->size);
    #  371|       for (i = 0; i < conv_prim->size; i++) {
    #  372|->         nums_equiv_atoms[i] = 0;
    #  373|       }
    #  374|

    Error: COMPILER_WARNING (CWE-457): [#def25]
    spglib-2.5.0-build/spglib-2.5.0/src/spacegroup.c:1094:17: warning[-Wmaybe-uninitialized]: ‘num_free_axes’ may be used uninitialized
    # 1094 |             if (match_hall_symbol_db_ortho(origin_shift, conv_lattice,
    #      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # 1095 |                                            orig_lattice, hall_number, centering,
    #      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # 1096 |                                            symmetry, num_free_axes, symprec)) {
    #      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    spglib-2.5.0-build/spglib-2.5.0/src/spacegroup.c: scope_hint: In function ‘search_hall_number’
    spglib-2.5.0-build/spglib-2.5.0/src/spacegroup.c:1026:19: note: ‘num_free_axes’ was declared here
    # 1026 |     int is_found, num_free_axes;
    #      |                   ^~~~~~~~~~~~~
    # 1092|               }
    # 1093|
    # 1094|->             if (match_hall_symbol_db_ortho(origin_shift, conv_lattice,
    # 1095|                                              orig_lattice, hall_number, centering,
    # 1096|                                              symmetry, num_free_axes, symprec)) {

    Error: COMPILER_WARNING (CWE-457): [#def26]
    spglib-2.5.0-build/spglib-2.5.0/src/spacegroup.c: scope_hint: In function ‘match_hall_symbol_db_monocli’
    spglib-2.5.0-build/spglib-2.5.0/src/spacegroup.c:1146:51: warning[-Wmaybe-uninitialized]: ‘j’ may be used uninitialized
    # 1146 |     int i, check_norms, i_shortest, is_found_any, j, num_change_of_basis;
    #      |                                                   ^
    # 1144|       int const group_number, Centering const centering,
    # 1145|       Symmetry const *conv_symmetry, double const symprec) {
    # 1146|->     int i, check_norms, i_shortest, is_found_any, j, num_change_of_basis;
    # 1147|       int is_found[36];
    # 1148|       double shortest_norm_sum, norm_sum;

    Error: CPPCHECK_WARNING (CWE-786): [#def27]
    spglib-2.5.0-build/spglib-2.5.0/src/spacegroup.c:1249: error[negativeIndex]: Array 'all_origin_shifts[36][3]' accessed at index -1, which is out of bounds.
    # 1247|       }
    # 1248|
    # 1249|->     mat_copy_vector_d3(origin_shift, all_origin_shifts[i_shortest]);
    # 1250|       mat_copy_matrix_d3(conv_lattice, all_conv_lattices[i_shortest]);
    # 1251|       return 1;

    Error: CPPCHECK_WARNING (CWE-786): [#def28]
    spglib-2.5.0-build/spglib-2.5.0/src/spacegroup.c:1250: error[negativeIndex]: Array 'all_conv_lattices[36][3][3]' accessed at index -1, which is out of bounds.
    # 1248|
    # 1249|       mat_copy_vector_d3(origin_shift, all_origin_shifts[i_shortest]);
    # 1250|->     mat_copy_matrix_d3(conv_lattice, all_conv_lattices[i_shortest]);
    # 1251|       return 1;
    # 1252|

    Error: CPPCHECK_WARNING (CWE-823): [#def29]
    spglib-2.5.0-build/spglib-2.5.0/src/spglib.c:248: error[arrayIndexOutOfBounds]: Array 'spglib_error_message[10]' accessed at index 99, which is out of bounds.
    #  246|
    #  247|       for (i = 0; i < 100; i++) {
    #  248|->         if (SPGERR_NONE == spglib_error_message[i].error) {
    #  249|               break;
    #  250|           }

    Error: CPPCHECK_WARNING (CWE-401): [#def30]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:212: error[memleak]: Memory leak: inv_perm
    #  210|
    #  211|       if ((exact_cell = cel_alloc_cell(cell->size, cell->tensor_rank)) == NULL) {
    #  212|->         return NULL;
    #  213|       }
    #  214|       mat_copy_matrix_d3(exact_cell->lattice, cell->lattice);

    Error: CPPCHECK_WARNING (CWE-401): [#def31]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:220: error[memleak]: Memory leak: inv_perm
    #  218|       if ((rotations_cart = (double(*)[3][3])malloc(
    #  219|                sizeof(double[3][3]) * magnetic_symmetry->size)) == NULL) {
    #  220|->         return NULL;
    #  221|       }
    #  222|       set_rotations_in_cartesian(rotations_cart, cell->lattice,

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def32]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c: scope_hint: In function ‘spn_get_idealized_cell’
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:246:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
    #  244|               }
    #  245|
    #  246|->             j = inv_perm[i]; /* p-th operation maps site-j to site-i */
    #  247|
    #  248|               apply_symmetry_to_position(pos_tmp, cell->position[j],

    Error: COMPILER_WARNING (CWE-457): [#def33]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c: scope_hint: In function ‘spn_get_idealized_cell’
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:272:35: warning[-Wmaybe-uninitialized]: ‘vector_res[0]’ may be used uninitialized
    #  272 |                     vector_res[s] += vector_tmp[s] - cell->tensors[3 * i + s];
    #      |                                   ^~
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:198:51: note: ‘vector_res[0]’ was declared here
    #  198 |     double pos_tmp[3], pos_res[3], vector_tmp[3], vector_res[3];
    #      |                                                   ^~~~~~~~~~
    #  270|                                                 with_time_reversal, is_axial);
    #  271|                   for (s = 0; s < 3; s++) {
    #  272|->                     vector_res[s] += vector_tmp[s] - cell->tensors[3 * i + s];
    #  273|                   }
    #  274|               }

    Error: COMPILER_WARNING (CWE-457): [#def34]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:272:35: warning[-Wmaybe-uninitialized]: ‘vector_res[1]’ may be used uninitialized
    #  272 |                     vector_res[s] += vector_tmp[s] - cell->tensors[3 * i + s];
    #      |                                   ^~
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:198:51: note: ‘vector_res[1]’ was declared here
    #  198 |     double pos_tmp[3], pos_res[3], vector_tmp[3], vector_res[3];
    #      |                                                   ^~~~~~~~~~
    #  270|                                                 with_time_reversal, is_axial);
    #  271|                   for (s = 0; s < 3; s++) {
    #  272|->                     vector_res[s] += vector_tmp[s] - cell->tensors[3 * i + s];
    #  273|                   }
    #  274|               }

    Error: COMPILER_WARNING (CWE-457): [#def35]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:272:35: warning[-Wmaybe-uninitialized]: ‘vector_res[2]’ may be used uninitialized
    #  272 |                     vector_res[s] += vector_tmp[s] - cell->tensors[3 * i + s];
    #      |                                   ^~
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:198:51: note: ‘vector_res[2]’ was declared here
    #  198 |     double pos_tmp[3], pos_res[3], vector_tmp[3], vector_res[3];
    #      |                                                   ^~~~~~~~~~
    #  270|                                                 with_time_reversal, is_axial);
    #  271|                   for (s = 0; s < 3; s++) {
    #  272|->                     vector_res[s] += vector_tmp[s] - cell->tensors[3 * i + s];
    #  273|                   }
    #  274|               }

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def36]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c: scope_hint: In function ‘get_symmetry_permutations’
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:614:47: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘scalar’
    #  612|                               i, scalar, j, cell->tensors[j]);
    #  613|                   if (cell->tensor_rank == COLLINEAR &&
    #  614|->                     !is_zero(cell->tensors[j] - scalar, mag_symprec)) {
    #  615|                       continue;
    #  616|                   }

    Error: COMPILER_WARNING (CWE-457): [#def37]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:614:47: warning[-Wmaybe-uninitialized]: ‘scalar’ may be used uninitialized
    #  614 |                     !is_zero(cell->tensors[j] - scalar, mag_symprec)) {
    #      |                              ~~~~~~~~~~~~~~~~~^~~~~~~~
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c: scope_hint: In function ‘spn_get_operations_with_site_tensors’
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:563:12: note: ‘scalar’ was declared here
    #  563 |     double scalar;
    #      |            ^~~~~~
    #  612|                               i, scalar, j, cell->tensors[j]);
    #  613|                   if (cell->tensor_rank == COLLINEAR &&
    #  614|->                     !is_zero(cell->tensors[j] - scalar, mag_symprec)) {
    #  615|                       continue;
    #  616|                   }

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def38]
    spglib-2.5.0-build/spglib-2.5.0/src/spin.c:618:60: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘vector[0]’
    #  616|                   }
    #  617|                   if (cell->tensor_rank == NONCOLLINEAR) {
    #  618|->                     diff[0] = cell->tensors[3 * j] - vector[0];
    #  619|                       diff[1] = cell->tensors[3 * j + 1] - vector[1];
    #  620|                       diff[2] = cell->tensors[3 * j + 2] - vector[2];

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def39]
    spglib-2.5.0-build/spglib-2.5.0/src/symmetry.c: scope_hint: In function ‘search_layer_pure_translations’
    spglib-2.5.0-build/spglib-2.5.0/src/symmetry.c:800:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘copy_atoms_found’
    #  798|       copy_atoms_found = (int *)malloc(sizeof(int) * cell->size);
    #  799|       for (i = 0; i < cell->size; i++) {
    #  800|->         copy_atoms_found[i] = atoms_found[i];
    #  801|       }
    #  802|

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def40]
    spglib-2.5.0-build/spglib-2.5.0/src/symmetry.c:804:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘copy_atoms_found’
    #  802|
    #  803|       for (initial_atom = 0; initial_atom < cell->size; initial_atom++) {
    #  804|->         if (!copy_atoms_found[initial_atom]) {
    #  805|               continue;
    #  806|           }

    Error: GCC_ANALYZER_WARNING (CWE-457): [#def41]
    spglib-2.5.0-build/spglib-2.5.0/src/symmetry.c:804:30: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
    #  802|
    #  803|       for (initial_atom = 0; initial_atom < cell->size; initial_atom++) {
    #  804|->         if (!copy_atoms_found[initial_atom]) {
    #  805|               continue;
    #  806|           }

    Error: COMPILER_WARNING (CWE-477): [#def42]
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_dataset_access.cpp: scope_hint: In member function ‘virtual void DatasetAccess_test_spg_get_hall_number_from_symmetry_Test::TestBody()’
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_dataset_access.cpp:37:52: warning[-Wdeprecated-declarations]: ‘int spg_get_hall_number_from_symmetry(const int (*)[3][3], const double (*)[3], int, double)’ is deprecated: Use the variable from SpglibSpacegroupType instead (hall_number)
    #   37 |     hall_number = spg_get_hall_number_from_symmetry(
    #      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    #   38 |         dataset->rotations, dataset->translations, dataset->n_operations,
    #      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #   39 |         symprec);
    #      |         ~~~~~~~~
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_dataset_access.cpp:4: included_from: Included from here.
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:357:13: note: declared here
    #  357 | SPG_API int spg_get_hall_number_from_symmetry(int const rotation[][3][3],
    #      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #   35|       printf("hall_number = %d is found by spg_get_dataset.\n",
    #   36|              dataset->hall_number);
    #   37|->     hall_number = spg_get_hall_number_from_symmetry(
    #   38|           dataset->rotations, dataset->translations, dataset->n_operations,
    #   39|           symprec);

    Error: COMPILER_WARNING (CWE-477): [#def43]
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_magnetic_symmetry.cpp: scope_hint: In member function ‘virtual void MagneticSymmetry_test_spg_get_symmetry_with_tensors_rough_symprec_Test::TestBody()’
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_magnetic_symmetry.cpp:224:28: warning[-Wdeprecated-declarations]: ‘int spg_get_symmetry(int (*)[3][3], double (*)[3], int, const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (rotations, translations)
    #  224 |     size = spg_get_symmetry(rotations, translations, max_size, lattice,
    #      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #  225 |                             positions, types, num_atoms, symprec);
    #      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_magnetic_symmetry.cpp:4: included_from: Included from here.
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:278:13: note: declared here
    #  278 | SPG_API int spg_get_symmetry(int rotation[][3][3], double translation[][3],
    #      |             ^~~~~~~~~~~~~~~~
    #  222|       time_reversals = (int *)malloc(sizeof(int *) * max_size);
    #  223|
    #  224|->     size = spg_get_symmetry(rotations, translations, max_size, lattice,
    #  225|                               positions, types, num_atoms, symprec);
    #  226|       ASSERT_EQ(size, 4);

    Error: COMPILER_WARNING (CWE-477): [#def44]
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_spacegroup_type_search.cpp: scope_hint: In member function ‘virtual void SpacegroupTypeSearch_test_spg_get_international_Test::TestBody()’
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_spacegroup_type_search.cpp:20:30: warning[-Wdeprecated-declarations]: ‘int spg_get_international(char*, const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (spacegroup_number, international_symbol)
    #   20 |         spg_get_international(symbol, lattice, position, types, num_atom, 1e-5);
    #      |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_spacegroup_type_search.cpp:4: included_from: Included from here.
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:398:13: note: declared here
    #  398 | SPG_API int spg_get_international(char symbol[11], double const lattice[3][3],
    #      |             ^~~~~~~~~~~~~~~~~~~~~
    #   18|
    #   19|       num_spg =
    #   20|->         spg_get_international(symbol, lattice, position, types, num_atom, 1e-5);
    #   21|       ASSERT_EQ(num_spg, 136);
    #   22|       ASSERT_STREQ(symbol, symbol_expect);

    Error: COMPILER_WARNING (CWE-477): [#def45]
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_spacegroup_type_search.cpp: scope_hint: In member function ‘virtual void SpacegroupTypeSearch_test_spg_get_schoenflies_Test::TestBody()’
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_spacegroup_type_search.cpp:38:28: warning[-Wdeprecated-declarations]: ‘int spg_get_schoenflies(char*, const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (spacegroup_number, international_symbol)
    #   38 |         spg_get_schoenflies(symbol, lattice, position, types, num_atom, 1e-5);
    #      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:414:13: note: declared here
    #  414 | SPG_API int spg_get_schoenflies(char symbol[7], double const lattice[3][3],
    #      |             ^~~~~~~~~~~~~~~~~~~
    #   36|
    #   37|       num_spg =
    #   38|->         spg_get_schoenflies(symbol, lattice, position, types, num_atom, 1e-5);
    #   39|       ASSERT_EQ(num_spg, 136);
    #   40|       ASSERT_STREQ(symbol, symbol_expect);

    Error: COMPILER_WARNING (CWE-477): [#def46]
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_symmetry_search.cpp: scope_hint: In member function ‘virtual void SymmetrySearch_test_spg_get_symmetry_Test::TestBody()’
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_symmetry_search.cpp:33:28: warning[-Wdeprecated-declarations]: ‘int spg_get_symmetry(int (*)[3][3], double (*)[3], int, const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (rotations, translations)
    #   33 |     size = spg_get_symmetry(rotation, translation, max_size, lattice, position,
    #      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #   34 |                             types, num_atom, 1e-5);
    #      |                             ~~~~~~~~~~~~~~~~~~~~~~
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_symmetry_search.cpp:4: included_from: Included from here.
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:278:13: note: declared here
    #  278 | SPG_API int spg_get_symmetry(int rotation[][3][3], double translation[][3],
    #      |             ^~~~~~~~~~~~~~~~
    #   31|
    #   32|       printf("*** spg_get_symmetry (Rutile two unit cells) ***:\n");
    #   33|->     size = spg_get_symmetry(rotation, translation, max_size, lattice, position,
    #   34|                               types, num_atom, 1e-5);
    #   35|       ASSERT_EQ(size, 32);

    Error: COMPILER_WARNING (CWE-477): [#def47]
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_symmetry_search.cpp: scope_hint: In member function ‘virtual void SymmetrySearch_test_spg_get_multiplicity_Test::TestBody()’
    spglib-2.5.0-build/spglib-2.5.0/test/functional/c/test_symmetry_search.cpp:81:32: warning[-Wdeprecated-declarations]: ‘int spg_get_multiplicity(const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (n_operations)
    #   81 |     size = spg_get_multiplicity(lattice, position, types, num_atom, 1e-5);
    #      |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    spglib-2.5.0-build/spglib-2.5.0/include/spglib.h:384:13: note: declared here
    #  384 | SPG_API int spg_get_multiplicity(double const lattice[3][3],
    #      |             ^~~~~~~~~~~~~~~~~~~~
    #   79|       int size;
    #   80|
    #   81|->     size = spg_get_multiplicity(lattice, position, types, num_atom, 1e-5);
    #   82|       ASSERT_EQ(size, 48);
    #   83|   }

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def48]
    spglib-2.5.0-build/spglib-2.5.0/test/utils.c: scope_hint: In function ‘sub_spg_standardize_cell’
    spglib-2.5.0-build/spglib-2.5.0/test/utils.c:159:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘typ’
    #  157|           pos[i][1] = position[i][1];
    #  158|           pos[i][2] = position[i][2];
    #  159|->         typ[i] = types[i];
    #  160|       }
    #  161|

## Scan Properties

analyzer-version-clippy | 1.84.0
analyzer-version-cppcheck | 2.16.2
analyzer-version-gcc | 15.0.1
analyzer-version-gcc-analyzer | 15.0.1
analyzer-version-shellcheck | 0.10.0
analyzer-version-unicontrol | 0.0.2
enabled-plugins | clippy, cppcheck, gcc, shellcheck, unicontrol
exit-code | 0
host | ip-172-16-1-75.us-west-2.compute.internal
mock-config | fedora-rawhide-x86_64
project-name | spglib-2.5.0-1.20250130025742515814.develop.54.g1624219
store-results-to | /tmp/tmpjcatdnv1/spglib-2.5.0-1.20250130025742515814.develop.54.g1624219.tar.xz
time-created | 2025-01-30 10:56:42
time-finished | 2025-01-30 10:58:49
tool | csmock
tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'cppcheck,clippy,shellcheck,gcc,unicontrol' '-o' '/tmp/tmpjcatdnv1/spglib-2.5.0-1.20250130025742515814.develop.54.g1624219.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '/tmp/tmpjcatdnv1/spglib-2.5.0-1.20250130025742515814.develop.54.g1624219.src.rpm'
tool-version | csmock-3.8.0-1.el9