Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 May 2022 14:32:23 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 264288] llvm miscompiles the extension ({ ... })
Message-ID:  <bug-264288-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264288

            Bug ID: 264288
           Summary: llvm miscompiles the extension ({ ... })
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: andrew.cagney@gmail.com

Given:


typedef const struct where {
        const char *func;
        const char *file;
        long line;
} *where_t;

and:

struct connection_filter {
        /* filters */
        enum connection_kind kind;
        const char *name;
        const struct id *this_id_eq; /* strict; not same_id() */
        const struct id *that_id_eq; /* strict; not same_id() */
        /* current result (can be safely deleted) */
        struct connection *c;
        /* internal: handle on next entry */
        struct list_entry *internal;
        /* internal: total matches so far */
        unsigned count;
        /* .where MUST BE LAST (See GCC bug 102288) */
        where_t where;
};

this:

+       struct connection_filter cq =3D {
+               .where =3D ({                             \
+                               static const struct where here =3D {      \
+                                       .func =3D __func__,               \
+                                       .file =3D __FILE__,               \
+                                       .line =3D __LINE__,               \
+                               };                                      \
+                               &here;                                  \
+                       }),
+       };
+       dbg("FOR_EACH_CONNECTION_... in %s %s %ld",
+           cq.where->func, cq.where->file, cq.where->line);


is mis-compiled.  It prints NULL, NULL, 0 when it should print __func__,
__FILE__, __LINE__.


Note:

- .where is last, yes that's a reall gcc bug
- only the field .where is initialized, if a second field is initialized th=
ings
seem to compile correctly
- I could include the assembler but I'm not sure of the point - the compiler
lost track of values in a static structure

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-264288-227>