[pcre-dev] [Bug 1477] New: 64-bit compiler warnings

Αρχική Σελίδα
Delete this message
Συντάκτης: A Light
Ημερομηνία:  
Προς: pcre-dev
Αντικείμενο: [pcre-dev] [Bug 1477] New: 64-bit compiler warnings
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1477
           Summary: 64-bit compiler warnings
           Product: PCRE
           Version: 8.35
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: aclight@???
                CC: pcre-dev@???



I'm getting a few compiler warnings when I compile 8.35 for 64-bit
architecture.


Note that for the clang compile, I am using the -Wshorten-64-to-32 compiler
flag.

Using both Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) and
MSVC 2013 I see these. They all look like cases where the difference of two
64-bit pointers is stored in an int:

../../igorsrc7/PCRE/pcre_compile.c:3041:17: warning: implicit conversion loses
integer precision: 'long' to 'pcre_uint32' (aka 'unsigned int')
[-Wshorten-64-to-32]
  list[2] = end - code;
          ~ ~~~~^~~~~~
../../igorsrc7/PCRE/pcre_compile.c:6011:44: warning: implicit conversion loses
integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                int save_offset = save_hwm - cd->start_workspace;
                    ~~~~~~~~~~~   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../../igorsrc7/PCRE/pcre_compile.c:6012:44: warning: implicit conversion loses
integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                int this_offset = this_hwm - cd->start_workspace;
                    ~~~~~~~~~~~   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../../igorsrc7/PCRE/pcre_compile.c:6093:40: warning: implicit conversion loses
integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            int save_offset = save_hwm - cd->start_workspace;
                ~~~~~~~~~~~   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../../igorsrc7/PCRE/pcre_compile.c:6094:40: warning: implicit conversion loses
integer precision: 'long' to 'int' [-Wshorten-64-to-32]
            int this_offset = this_hwm - cd->start_workspace;
                ~~~~~~~~~~~   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~




I only see these using clang:
../../igorsrc7/PCRE/pcre_dfa_exec.c:3245:36: warning: implicit conversion loses
integer precision: 'const unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
  unsigned int flags = extra_data->flags;
               ~~~~~   ~~~~~~~~~~~~^~~~~


../../igorsrc7/PCRE/pcre_exec.c:6522:45: warning: implicit conversion loses
integer precision: 'const unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
  register unsigned int flags = extra_data->flags;
                        ~~~~~   ~~~~~~~~~~~~^~~~~


Using VS2013 only, I see this:
C4244: '+=' : conversion from '__int64' to 'int', possible loss of data in
pcre_compile.c line 4866.

Thanks
Adam


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email