Errors building cygwin with latest gcc

Ken Brown kbrown@cornell.edu
Wed Aug 25 22:03:36 GMT 2021


With the recently uploaded gcc-11.2.0, I'm seeing three types of errors when 
building cygwin:

1.  In file included from ../../../../../newlib-cygwin/winsup/utils/mingw/path.cc:1:
../../../../../newlib-cygwin/winsup/utils/mingw/../path.cc: In function ‘char* 
conv_fstab_spaces(char*)’:
../../../../../newlib-cygwin/winsup/utils/mingw/../path.cc:286:18: error: ISO 
C++17 does not allow ‘register’ storage class specifier [-Werror=register]
   286 |   register char *sp = field;

Removing all the 'register' specifiers fixes these and I guess is harmless.

2. In member function ‘int dumper::dump_module(asection*, process_module*)’,
     inlined from ‘int dumper::dump_module(asection*, process_module*)’ at 
../../../../newlib-cygwin/winsup/utils/dumper.cc:533:1:
../../../../newlib-cygwin/winsup/utils/dumper.cc:562:11: error: ‘char* 
strncpy(char*, const char*, size_t)’ writing 16 bytes into a region of size 1 
overflows the destination [-Werror=stringop-overflow=]
   562 |   strncpy (header.elf_note_header.name, "win32module", NOTE_NAME_SIZE);
       |   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../../newlib-cygwin/winsup/utils/dumper.cc:25:
../../../../newlib-cygwin/winsup/../include/elf/external.h: In member function 
‘int dumper::dump_module(asection*, process_module*)’:
../../../../newlib-cygwin/winsup/../include/elf/external.h:169:17: note: 
destination object ‘Elf_External_Note::name’ of size 1
   169 |   char          name[1];                /* Start of the name+desc data */

The code contains

#pragma GCC diagnostic ignored "-Wstringop-overflow"

which should have prevented that error, shouldn't it?

3. ../../../../newlib-cygwin/winsup/cygwin/miscfuncs.cc: In member function 
‘void* thread_allocator::_alloc(SIZE_T)’:
../../../../newlib-cygwin/winsup/cygwin/miscfuncs.cc:522:5: error: 
‘MEM_EXTENDED_PARAMETER::<unnamed struct>’ has no non-static data member named 
‘Pointer’
   522 |     };

This one completely mystifies me, given the definition of MEM_EXTENDED_PARAMETER 
in /usr/include/w32api/winnt.h.  Is there some problem with the use of an 
unnamed struct and unnamed union in that definition?

Ken


More information about the Cygwin-developers mailing list