Fix null pointer warning for string argument to parse_struct in registry code#196
Merged
mgduda merged 1 commit intoMPAS-Dev:developfrom Apr 9, 2019
Merged
Conversation
…try code
The fifth argument to the parse_struct function in the gen_inc code is
a const char*. The call to parse_struct previously passed a C null character,
'\0', which evaluates to zero and is therefore interpreted as a null pointer.
It was likely intended to pass an empty C string, i.e., a string consisting
of a single null character, in the call to parse_struct, using "\0" rather
than '\0'. This was picked up by the XL C compiler:
gen_inc.c:2531:52: warning: expression which evaluates to zero treated as a null pointer constant of type 'const char *'
[-Wnon-literal-null-conversion]
err = parse_struct(fd, registry, structs_xml, 0, '\0', corename);
^~~~
This warning turns out to be harmless, as the fifth argument to parse_struct
is only used when the fourth argument is non-zero.
This was referenced Apr 4, 2019
matthewhoffman
approved these changes
Apr 5, 2019
mark-petersen
approved these changes
Apr 7, 2019
Contributor
mark-petersen
left a comment
There was a problem hiding this comment.
Visual check, passes ocean nightly regression suite.
mgduda
added a commit
that referenced
this pull request
Apr 9, 2019
…#196) This merge fixes a null pointer warning for a string argument to parse_struct in the registry code. The fifth argument to the parse_struct function in the gen_inc code is a const char*. The call to parse_struct previously passed a C null character, '\0', which evaluates to zero and is therefore interpreted as a null pointer. It was likely intended to pass an empty C string, i.e., a string consisting of a single null character, in the call to parse_struct, using "\0" rather than '\0'. This was picked up by the XL C compiler: gen_inc.c:2531:52: warning: expression which evaluates to zero treated as a null pointer constant of type 'const char *' [-Wnon-literal-null-conversion] err = parse_struct(fd, registry, structs_xml, 0, '\0', corename); ^~~~ This warning turns out to be harmless, as the fifth argument to parse_struct is only used when the fourth argument is non-zero. * framework/fix_parse_struct_null_string: Fix null pointer warning for string argument to parse_struct in registry code
mark-petersen
added a commit
that referenced
this pull request
Apr 10, 2019
Updating MPAS framework. This includes: - Rename Makefile.in.ACME to Makefile.in.E3SM: #195 - Change Makefile.in.E3SM to standard CESM formatting (TRUE in caps): #191 - Add -Uvector to Makefile.in.E3SM to ignore the word 'vector' in comments when using GEN_F90=TRUE: #200, fixes #2725 - Fix memory leak due to double allocate, only used by RK4 time stepping, does not change E3SM runs: #185 - Changes to atmosphere directories are not used by E3SM. - COMPASS testing updates, not used by E3SM, including python 3 updates. - Fix typos that cause warnings on some compilers: #196, #197, #198, #199
mark-petersen
added a commit
that referenced
this pull request
Apr 10, 2019
Updating MPAS framework. This includes: - Rename Makefile.in.ACME to Makefile.in.E3SM: #195 - Change Makefile.in.E3SM to standard CESM formatting (TRUE in caps): #191 - Add -Uvector to Makefile.in.E3SM to ignore the word 'vector' in comments when using GEN_F90=TRUE: #200, fixes #2725 - Fix memory leak due to double allocate, only used by RK4 time stepping, does not change E3SM runs: #185 - Changes to atmosphere directories are not used by E3SM. - COMPASS testing updates, not used by E3SM, including python 3 updates. - Fix typos that cause warnings on some compilers: #196, #197, #198, #199
ashwathsv
pushed a commit
to ashwathsv/MPAS-Model
that referenced
this pull request
Jul 21, 2020
Updating MPAS framework. This includes: - Rename Makefile.in.ACME to Makefile.in.E3SM: MPAS-Dev#195 - Change Makefile.in.E3SM to standard CESM formatting (TRUE in caps): MPAS-Dev#191 - Add -Uvector to Makefile.in.E3SM to ignore the word 'vector' in comments when using GEN_F90=TRUE: MPAS-Dev#200, fixes #2725 - Fix memory leak due to double allocate, only used by RK4 time stepping, does not change E3SM runs: MPAS-Dev#185 - Changes to atmosphere directories are not used by E3SM. - COMPASS testing updates, not used by E3SM, including python 3 updates. - Fix typos that cause warnings on some compilers: MPAS-Dev#196, MPAS-Dev#197, MPAS-Dev#198, MPAS-Dev#199
mark-petersen
added a commit
to mark-petersen/MPAS-Model
that referenced
this pull request
Jan 11, 2021
Updating MPAS framework. This includes: - Rename Makefile.in.ACME to Makefile.in.E3SM: MPAS-Dev#195 - Change Makefile.in.E3SM to standard CESM formatting (TRUE in caps): MPAS-Dev#191 - Add -Uvector to Makefile.in.E3SM to ignore the word 'vector' in comments when using GEN_F90=TRUE: MPAS-Dev#200, fixes #2725 - Fix memory leak due to double allocate, only used by RK4 time stepping, does not change E3SM runs: MPAS-Dev#185 - Changes to atmosphere directories are not used by E3SM. - COMPASS testing updates, not used by E3SM, including python 3 updates. - Fix typos that cause warnings on some compilers: MPAS-Dev#196, MPAS-Dev#197, MPAS-Dev#198, MPAS-Dev#199
caozd999
pushed a commit
to caozd999/MPAS-Model
that referenced
this pull request
Jan 14, 2021
Updating MPAS framework. This includes: - Rename Makefile.in.ACME to Makefile.in.E3SM: MPAS-Dev#195 - Change Makefile.in.E3SM to standard CESM formatting (TRUE in caps): MPAS-Dev#191 - Add -Uvector to Makefile.in.E3SM to ignore the word 'vector' in comments when using GEN_F90=TRUE: MPAS-Dev#200, fixes #2725 - Fix memory leak due to double allocate, only used by RK4 time stepping, does not change E3SM runs: MPAS-Dev#185 - Changes to atmosphere directories are not used by E3SM. - COMPASS testing updates, not used by E3SM, including python 3 updates. - Fix typos that cause warnings on some compilers: MPAS-Dev#196, MPAS-Dev#197, MPAS-Dev#198, MPAS-Dev#199
mark-petersen
added a commit
to mark-petersen/MPAS-Model
that referenced
this pull request
Jan 16, 2021
Updating MPAS framework. This includes: - Rename Makefile.in.ACME to Makefile.in.E3SM: MPAS-Dev#195 - Change Makefile.in.E3SM to standard CESM formatting (TRUE in caps): MPAS-Dev#191 - Add -Uvector to Makefile.in.E3SM to ignore the word 'vector' in comments when using GEN_F90=TRUE: MPAS-Dev#200, fixes #2725 - Fix memory leak due to double allocate, only used by RK4 time stepping, does not change E3SM runs: MPAS-Dev#185 - Changes to atmosphere directories are not used by E3SM. - COMPASS testing updates, not used by E3SM, including python 3 updates. - Fix typos that cause warnings on some compilers: MPAS-Dev#196, MPAS-Dev#197, MPAS-Dev#198, MPAS-Dev#199
mark-petersen
added a commit
to mark-petersen/MPAS-Model
that referenced
this pull request
Jan 19, 2021
Updating MPAS framework. This includes: - Rename Makefile.in.ACME to Makefile.in.E3SM: MPAS-Dev#195 - Change Makefile.in.E3SM to standard CESM formatting (TRUE in caps): MPAS-Dev#191 - Add -Uvector to Makefile.in.E3SM to ignore the word 'vector' in comments when using GEN_F90=TRUE: MPAS-Dev#200, fixes #2725 - Fix memory leak due to double allocate, only used by RK4 time stepping, does not change E3SM runs: MPAS-Dev#185 - Changes to atmosphere directories are not used by E3SM. - COMPASS testing updates, not used by E3SM, including python 3 updates. - Fix typos that cause warnings on some compilers: MPAS-Dev#196, MPAS-Dev#197, MPAS-Dev#198, MPAS-Dev#199
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This merge fixes a null pointer warning for a string argument to parse_struct
in the registry code.
The fifth argument to the parse_struct function in the gen_inc code is
a const char*. The call to parse_struct previously passed a C null character,
'\0', which evaluates to zero and is therefore interpreted as a null pointer.
It was likely intended to pass an empty C string, i.e., a string consisting
of a single null character, in the call to parse_struct, using "\0" rather
than '\0'. This was picked up by the XL C compiler:
This warning turns out to be harmless, as the fifth argument to parse_struct
is only used when the fourth argument is non-zero.