[Bug c/65471] type interpretation in _Generic

2016-06-09 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65471

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Marek Polacek  ---
Fixed.

[Bug c/65471] type interpretation in _Generic

2016-06-09 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65471

--- Comment #5 from Marek Polacek  ---
Author: mpolacek
Date: Thu Jun  9 10:16:19 2016
New Revision: 237252

URL: https://gcc.gnu.org/viewcvs?rev=237252=gcc=rev
Log:
PR c/65471
* gcc.dg/c11-generic-3.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/c11-generic-3.c
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c/65471] type interpretation in _Generic

2016-06-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65471

Marek Polacek  changed:

   What|Removed |Added

 Status|SUSPENDED   |NEW

--- Comment #4 from Marek Polacek  ---
I think no longer SUSPENDED, given
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg01054.html .  I'll add the
testcase in Comment 1.

[Bug c/65471] type interpretation in _Generic

2016-02-22 Thread wink at saville dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65471

Wink Saville  changed:

   What|Removed |Added

 CC||wink at saville dot com

--- Comment #3 from Wink Saville  ---
Tested on on gcc 5.3.0 on an x86_64 Arch Linux machine.

When using bit field as a selector _Generic uses the default path
and in the following test program outputs "unknown":

$ cat test.c

$ cat test.c
#include 

struct S {
  int b0:4;
  unsigned int b1:4;
  unsigned long long int b33:33;
};

#define type2str(__x) _Generic((__x), \
  int : "int", \
  unsigned int : "unsigned int", \
  unsigned long long int : "unsigned long long int", \
  default : "unknown")

int main(void) {
  struct S s = { .b0=3, .b1=4, .b33=0x1 };
  (void)s; // Not used

   // gcc | clang output
  printf("type2str(s.b0):  %s\n", type2str(s.b0)); // unknown | int
  printf("type2str(s.b1):  %s\n", type2str(s.b1)); // unknown | unsigned int
  printf("type2str(s.b33): %s\n", type2str(s.b33));// unknown | unsigned long
long int

  return 0;
}

$ cat Makefile 
CC = gcc
O = 3
STD = c11
M = 32

test: test.c Makefile
$(CC) -O$(O) -m$(M) -Wall -std=$(STD) test.c -o test

clean:
rm -f test


$ make clean ; make CC=gcc ; ./test
rm -f test
gcc -O3 -m32 -Wall -std=c11 test.c -o test
type2str(s.b0):  unknown
type2str(s.b1):  unknown
type2str(s.b33): unknown

$ make clean ;make CC=clang ; ./test
rm -f test
clang -O3 -m32 -Wall -std=c11 test.c -o test
type2str(s.b0):  int
type2str(s.b1):  unsigned int
type2str(s.b33): unsigned long long int


Additional discussion on gcc thread:
https://gcc.gnu.org/ml/gcc/2016-02/msg00255.html

[Bug c/65471] type interpretation in _Generic

2015-05-11 Thread jens.gustedt at inria dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65471

--- Comment #2 from Jens Gustedt jens.gustedt at inria dot fr ---
For referece, I have now a paper at the ISO committee:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1930.htm

we will look at it in the automn session to decide what to do with it.


[Bug c/65471] type interpretation in _Generic

2015-03-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65471

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |SUSPENDED
   Last reconfirmed||2015-03-25
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek mpolacek at gcc dot gnu.org ---
Suspending until the DR is resolved.