From 9acff105847ea3cba56045ec1f8ab992b2e7f57e Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Mon, 13 Jun 2005 15:06:47 -0500 Subject: [svn-r10915] Purpose: work around a compiler bug Description: while compiling in mir with pgcc -O2 a condition if (name ) { do_something(name); } is executed when name is NULL Solution: avoid the error by checking the NULL pointer inside do_something(name); Platforms tested: linux (mir with pgcc 6.0) Misc. update: --- tools/lib/h5diff_dset.c | 6 ++++-- tools/lib/h5diff_util.c | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index a558987..1887df8 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -362,10 +362,12 @@ hsize_t diff_datasetid( hid_t dset1_id, * array compare *------------------------------------------------------------------------- */ - if (obj1_name) + if (obj1_name) { name1=diff_basename(obj1_name); - if (obj2_name) + } + if (obj2_name) { name2=diff_basename(obj2_name); + } nfound = diff_array(buf1, buf2, nelmts1, diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 4f1e97c..34686c6 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -283,6 +283,9 @@ diff_basename(const char *name) { size_t i; + if (name==NULL) + return; + /* Find the end of the base name */ i = strlen(name); while (i>0 && '/'==name[i-1]) -- cgit v0.12