public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* ssize_t
@ 2016-12-22 19:40 Marco Atzeri
  2016-12-22 20:14 ` ssize_t Eric Blake
  2016-12-22 20:51 ` ssize_t Hans-Bernhard Bröker
  0 siblings, 2 replies; 6+ messages in thread
From: Marco Atzeri @ 2016-12-22 19:40 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

Hi guys,

building latest Imagemagick, the test for ssize_t is now failing with a
puzzling

  $ gcc  ssize_t.c -o ssize_t
ssize_t.c: In function ‘main’:
ssize_t.c:115:22: error: expected expression before ‘)’ token
  if (sizeof ((ssize_t)))
                       ^

any clue what to look for ?
Attached the test from config.log.

$ uname -svr
CYGWIN_NT-6.1 2.6.1(0.305/5/3) 2016-12-16 11:55

Regards
Marco





[-- Attachment #2: ssize_t.c --]
[-- Type: text/plain, Size: 2839 bytes --]

/* confdefs.h */
#define PACKAGE_NAME "ImageMagick"
#define PACKAGE_TARNAME "ImageMagick"
#define PACKAGE_VERSION "6.9.7-0"
#define PACKAGE_STRING "ImageMagick 6.9.7-0"
#define PACKAGE_BUGREPORT "https://github.com/ImageMagick/ImageMagick/issues"
#define PACKAGE_URL "https://www.imagemagick.org"
#define PACKAGE "ImageMagick"
#define VERSION "6.9.7-0"
#define MAGICK_TARGET_CPU x86_64
#define MAGICK_TARGET_VENDOR unknown
#define MAGICK_TARGET_OS cygwin
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define __EXTENSIONS__ 1
#define _ALL_SOURCE 1
#define _GNU_SOURCE 1
#define _POSIX_PTHREAD_SEMANTICS 1
#define _TANDEM_SOURCE 1
#define HAVE___ATTRIBUTE__ 1
#define SIZEOF_SIZE_T 8
#define WINGDI32_DELEGATE 1
#define HAVE_PTHREAD 1
#define THREAD_SUPPORT 1
#define HAVE_PTHREAD 1
#define HAVE_FSEEKO 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define INSTALLED_SUPPORT 1
#define CIPHER_SUPPORT 1
#define HDRI_ENABLE_OBSOLETE_IN_H 0
#define QUANTUM_DEPTH_OBSOLETE_IN_H 16
#define STDC_HEADERS 1
#define HAVE_DIRENT_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_COMPLEX_H 1
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_LIMITS_H 1
#define HAVE_LOCALE_H 1
#define HAVE_MACHINE_PARAM_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_PROCESS_H 1
#define HAVE_STDARG_H 1
#define HAVE_SYS_IPC_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMEB_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_UTIME_H 1
#define HAVE_WCHAR_H 1
#define HAVE__BOOL 1
#define HAVE_STDBOOL_H 1
#define HAVE_STRINGIZE 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_STRUCT_TM_TM_ZONE 1
#define HAVE_TM_ZONE 1
#define restrict __restrict
#define HAVE_UNSIGNED_LONG_LONG_INT 1
#define HAVE_LONG_LONG_INT 1
#define HAVE_INTMAX_T 1
#define HAVE_INTPTR_T 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_LONG_DOUBLE_WIDER 1
#define HAVE_LONG_LONG_INT 1
#define HAVE_MBSTATE_T 1
/* end confdefs.h.  */
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
#  include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
int
main ()
{
if (sizeof ((ssize_t)))
	    return 0;
  ;
  return 0;
}

[-- Attachment #3: Type: text/plain, Size: 219 bytes --]


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ssize_t
  2016-12-22 19:40 ssize_t Marco Atzeri
@ 2016-12-22 20:14 ` Eric Blake
  2016-12-22 20:19   ` ssize_t Eric Blake
  2016-12-22 20:51 ` ssize_t Hans-Bernhard Bröker
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Blake @ 2016-12-22 20:14 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 877 bytes --]

On 12/22/2016 01:39 PM, Marco Atzeri wrote:
> Hi guys,
> 
> building latest Imagemagick, the test for ssize_t is now failing with a
> puzzling
> 
>  $ gcc  ssize_t.c -o ssize_t
> ssize_t.c: In function ‘main’:
> ssize_t.c:115:22: error: expected expression before ‘)’ token
>  if (sizeof ((ssize_t)))
>                       ^
> 
> any clue what to look for ?

That's probably SUPPOSED to happen.

Autoconf tests for type names by comparing:

sizeof(TYPE) /* should compile */

with

sizeof((TYPE)) /* should not compile */

If 'TYPE' is instead a constant, then both forms will compile.  So it
allows you to probe whether an unknown string (in this case 'ssize_t')
is a type name or some other macro that expands into a constant.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ssize_t
  2016-12-22 20:14 ` ssize_t Eric Blake
@ 2016-12-22 20:19   ` Eric Blake
  2016-12-22 22:25     ` ssize_t Marco Atzeri
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2016-12-22 20:19 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 2877 bytes --]

On 12/22/2016 02:14 PM, Eric Blake wrote:

>> ssize_t.c:115:22: error: expected expression before ‘)’ token
>>  if (sizeof ((ssize_t)))
>>                       ^

> That's probably SUPPOSED to happen.
> 
> Autoconf tests for type names by comparing:

In fact, read the autoconf source code:

http://git.sv.gnu.org/cgit/autoconf.git/tree/lib/autoconf/types.m4#n56


# _AC_CHECK_TYPE_NEW_BODY
# -----------------------
# Shell function body for _AC_CHECK_TYPE_NEW.  This macro implements the
# former task of AC_CHECK_TYPE, with one big difference though:
AC_CHECK_TYPE
# used to grep in the headers, which, BTW, led to many problems until the
# extended regular expression was correct and did not give false positives.
# It turned out there are even portability issues with egrep...
#
# The most obvious way to check for a TYPE is just to compile a variable
# definition:
#
#	  TYPE my_var;
#
# (TYPE being the second parameter to the shell function, hence $[]2 in m4).
# Unfortunately this does not work for const qualified types in C++, where
# you need an initializer.  So you think of
#
#	  TYPE my_var = (TYPE) 0;
#
# Unfortunately, again, this is not valid for some C++ classes.
#
# Then you look for another scheme.  For instance you think of declaring
# a function which uses a parameter of type TYPE:
#
#	  int foo (TYPE param);
#
# but of course you soon realize this does not make it with K&R
# compilers.  And by no means do you want to use this:
#
#	  int foo (param)
#	    TYPE param
#	  { ; }
#
# since C++ would complain loudly.
#
# Don't even think of using a function return type, since K&R cries
# there too.  So you start thinking of declaring a *pointer* to this TYPE:
#
#	  TYPE *p;
#
# but you know fairly well that this is legal in C for aggregates which
# are unknown (TYPE = struct does-not-exist).
#
# Then you think of using sizeof to make sure the TYPE is really
# defined:
#
#	  sizeof (TYPE);
#
# That is great, but has one drawback: it succeeds when TYPE happens
# to be a variable: you'd get the size of the variable's type.
# Obviously, we must not accept a variable in place of a type name.
#
# So, to filter out the last possibility, we will require that this fail:
#
#	  sizeof ((TYPE));
#
# This evokes a syntax error when TYPE is a type, but succeeds if TYPE
# is actually a variable.
#
# Also note that we use
#
#	  if (sizeof (TYPE))
#
# to `read' sizeof (to avoid warnings), while not depending on its type
# (not necessarily size_t etc.).
#
# C++ disallows defining types inside `sizeof ()', but that's OK,
# since we don't want to consider unnamed structs to be types for C++,
# precisely because they don't work in cases like that.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ssize_t
  2016-12-22 19:40 ssize_t Marco Atzeri
  2016-12-22 20:14 ` ssize_t Eric Blake
@ 2016-12-22 20:51 ` Hans-Bernhard Bröker
  2016-12-22 21:11   ` ssize_t Eric Blake
  1 sibling, 1 reply; 6+ messages in thread
From: Hans-Bernhard Bröker @ 2016-12-22 20:51 UTC (permalink / raw)
  To: cygwin

Am 22.12.2016 um 20:39 schrieb Marco Atzeri:

> building latest Imagemagick, the test for ssize_t is now failing with a
> puzzling
>
>  $ gcc  ssize_t.c -o ssize_t
> ssize_t.c: In function ‘main’:
> ssize_t.c:115:22: error: expected expression before ‘)’ token
>  if (sizeof ((ssize_t)))
>                       ^
>
> any clue what to look for ?


The test case reduces to a very simple one-liner:

int bar = sizeof((int));

Replacing the double (()) by single () gets rid of the miscompilation.

That looks like a bona fide GCC bug.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ssize_t
  2016-12-22 20:51 ` ssize_t Hans-Bernhard Bröker
@ 2016-12-22 21:11   ` Eric Blake
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2016-12-22 21:11 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1: Type: text/plain, Size: 1290 bytes --]

On 12/22/2016 02:51 PM, Hans-Bernhard Bröker wrote:
> Am 22.12.2016 um 20:39 schrieb Marco Atzeri:
> 
>> building latest Imagemagick, the test for ssize_t is now failing with a
>> puzzling
>>
>>  $ gcc  ssize_t.c -o ssize_t
>> ssize_t.c: In function ‘main’:
>> ssize_t.c:115:22: error: expected expression before ‘)’ token
>>  if (sizeof ((ssize_t)))
>>                       ^
>>
>> any clue what to look for ?
> 
> 
> The test case reduces to a very simple one-liner:
> 
> int bar = sizeof((int));
> 
> Replacing the double (()) by single () gets rid of the miscompilation.
> 
> That looks like a bona fide GCC bug.

That is NOT a gcc bug, but deliberate configure behavior.  Remember, not
ALL conftest compilation probes during configure failures are supposed
to compile - some are expected to fail.  Debugging configure failures
requires that you ALSO know whether the compilation failure is expected
(as in this case), by knowing additional context of WHY configure is
trying to compile the test code (here, to PROVE that ssize_t is an
actual type name, and not just a variable name that expands to an
expression rather than a type).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ssize_t
  2016-12-22 20:19   ` ssize_t Eric Blake
@ 2016-12-22 22:25     ` Marco Atzeri
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Atzeri @ 2016-12-22 22:25 UTC (permalink / raw)
  To: cygwin

On 22/12/2016 21:19, Eric Blake wrote:
> On 12/22/2016 02:14 PM, Eric Blake wrote:
>
>>> ssize_t.c:115:22: error: expected expression before ‘)’ token
>>>  if (sizeof ((ssize_t)))
>>>                       ^
>
>> That's probably SUPPOSED to happen.
>>
>> Autoconf tests for type names by comparing:

adding [] in few points solved the issue.
-AC_CHECK_SIZEOF(ssize_t)
+AC_CHECK_SIZEOF([ssize_t])

Thanks
Marco

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-22 22:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22 19:40 ssize_t Marco Atzeri
2016-12-22 20:14 ` ssize_t Eric Blake
2016-12-22 20:19   ` ssize_t Eric Blake
2016-12-22 22:25     ` ssize_t Marco Atzeri
2016-12-22 20:51 ` ssize_t Hans-Bernhard Bröker
2016-12-22 21:11   ` ssize_t Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).