Giter VIP home page Giter VIP logo

Comments (7)

acid-maker avatar acid-maker commented on May 17, 2024

I can't reproduce this messages. I've compiled both versions (2.0.x and 3.0.x) using clang 3.7.1 and gcc 4.9.2 with warning/extra options: -std=c99 -Wall -Wextra -Wshadow -Warray-bounds -pedantic -fwrapv. Using clang I've compiled without optimizations (-O0), but using gcc I've compiled with classic -O2 option (optimizations may change warning messages, so this might be important).


My clang (Mac OS X) info:
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix


My gcc (Linux debian 8) info:
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I've also checked the code and those are calling of strcmp function with short constant string as one of the parameters. This is code such: if (strcmp(name,"..")==0) { ... }. This code looks correct as long as "name" is correct, but the "name" is external variable of type char*, so it is not possible to check the size. The only way is to assume that there is always zero at the end (correct C string) and in such case strcmp will never access array past the end.

Nevertheless I would like to reproduce this messages myself, because maybe I will be able to change something in the code to silent these warnings, so I've question. How to reproduce it? Which compiler/operating system should I use?

from moosefs.

onlyjob avatar onlyjob commented on May 17, 2024

This is with GCC-5 which is default in Debian "testing". Merely compiling in Debian "testing" should be enough to reproduce.

gcc-5.real (Debian 5.3.1-10) 5.3.1 20160224

from moosefs.

acid-maker avatar acid-maker commented on May 17, 2024

Still nothing. We have installed debian 'testing'.

uname -a:

Linux debian-testing 4.3.0-1-amd64 #1 SMP Debian 4.3.5-1 (2016-02-06) x86_64 GNU/Linux

gcc --version:

gcc (Debian 5.3.1-10) 5.3.1 20160224 (...)

I've found something else (false negative of compiler, but still worth fixing), but not even one of your errors.

It's little strange that your compiler only has problems with short strings. Here is fragment of exports.c code:

                        if (strcmp(p,"ro")==0) {
                                arec->sesflags |= SESFLAG_READONLY;
                                o=1;
                        } else if (strcmp(p,"readonly")==0) {
                                arec->sesflags |= SESFLAG_READONLY;
                                o=1;
                        } else if (strcmp(p,"rw")==0) {
                                arec->sesflags &= ~SESFLAG_READONLY;
                                o=1;
                        } else if (strcmp(p,"readwrite")==0) {
                                arec->sesflags &= ~SESFLAG_READONLY;
                                o=1;
                        }

Construction used for strings "ro" and "rw" is the same as in case of strings "readonly" and "readwrite" and your compiler reports only short ones. Really strange.

I've tried building package (dpkg-buildpackage), classic "./configure && make" and also manually compiled exports.c with explicitly added "-Warray-bounds" option and nothing.

from moosefs.

onlyjob avatar onlyjob commented on May 17, 2024

My bad, I've just realised that MooseFS build system prefer clang over GCC... Those warnings are actually from clang, not from GCC.

Clang version string is this:

Debian clang version 3.6.2-3 (tags/RELEASE_362/final) (based on LLVM 3.6.2)

With GCC I've noticed only the following warnings:

../../mfscommon/datapack.h:50:2: warning: ‘nextcidptr’ may be used uninitialized in this function [-Wmaybe-uninitialized] 
  memcpy(*ptr,&val,8); 
  ^ 
../../mfsmaster/filesystem.c:6462:11: note: ‘nextcidptr’ was declared here 
  uint8_t *nextcidptr; 
           ^ 
../../mfsmetadump/main.c:754:4: warning: ‘umaskval’ may be used uninitialized in this function [-Wmaybe-uninitialized] 
    printf("SESSION|s:%10"PRIu32"|e:#%"PRIu64"|p:%s|r:%10"PRIu32"|f:%02"PRIX8"|u:%03"PRIo16"|g:%"PRIu8"-%"PRIu8"|t:%10"PRIu32"-%10"PRIu32"|m:%10"PRIu32",%10"PRIu32",%10"PRIu32",%10"PRIu32"|d:%10"PRIu32"|c:",sessionid,exportscsum,strip,rootinode,sesflags,umaskval,mingoal,maxgoal,mintrashtime,maxtrashtime,rootuid,rootgid,mapalluid,mapallgid,disconnected);
    ^ 
../../mfsmetadump/main.c:663:11: note: ‘umaskval’ was declared here 
  uint16_t umaskval;
           ^ 

from moosefs.

acid-maker avatar acid-maker commented on May 17, 2024

Thanks. I'll check it using clang on debian 'testing'. Warnings from GCC are those "false negatives" I've mentioned. Nevertheless I've fixed them - because I hate warnings :)

from moosefs.

acid-maker avatar acid-maker commented on May 17, 2024

Still nothing. My clang:

Debian clang version 3.6.2-3 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
Target: x86_64-pc-linux-gnu
Thread model: posix

OS - debian testing. Architecture amd64. No warnings from compiler (clang is probably little better than gcc in case of false negatives - this is probably why it didn't give me any warnings). This is exactly the same version of compiler. Almost unbelievable. Maybe you have some special system-wide settings? Special compiler flags? Did you try to invoke make with V=1? You will see all arguments given to the compiler.

In my case (and exports.c) it look like this:

clang -DHAVE_CONFIG_H -I. -I.. -I../mfscommon -DMFSMAXFILES=16384 -DAPPNAME=mfsmaster -D_GNU_SOURCE -DDEFAULT_SUGID_CLEAR_MODE_EXT -O2 -g -O2 -g -std=c99 -Wall -Wextra -Wshadow -pedantic -fwrapv -MT mfsmaster-exports.o -MD -MP -MF .deps/mfsmaster-exports.Tpo -c -o mfsmaster-exports.otest -f 'exports.c' || echo './'exports.c

It really bothers me, because I don't like compiler warnings. Usually they mean something, but in this case I can't even reproduce them. And also the code looks correct (or I'm really stupid ;) ).

from moosefs.

pkonopelko avatar pkonopelko commented on May 17, 2024

I'm closing this issue, because we were not able to reproduce these warnings.

from moosefs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.