~mcf

https://github.com/michaelforney/

Trackers

~mcf/cc-issues

Last active a month ago

~mcf/qbe

Last active 6 months ago

~mcf/oasis

Last active 6 months ago

~mcf/sbase

Last active 7 months ago

~mcf/samurai

Last active 10 months ago

#16 Syntax error on a struct definition a month ago

Comment by ~mcf on ~sircmpwn/annotate

I think this is due to how identifiers are handled in the lexer. Currently, if the identifier matches a type name, it always returns TYPEDEF_NAME, but depending on the context, this might not be correct.

Here are some examples that this breaks:

typedef struct A A;
struct A {int x;};
typedef int B;
void f(B *B);
typedef int C;
void f(void) {
    goto C;
C:;
}

See also https://en.wikipedia.org/wiki/The_lexer_hack

#69 Write manual page 2 months ago

Ticket created by ~mcf on ~mcf/cc-issues

#63 __attribute__((constructor)) 2 months ago

Comment by ~mcf on ~mcf/cc-issues

pixman also uses this, but has fallback code for systems that don't support it.

However, since we currently define away all attributes (#68), we cannot detect support for this with just a compile test. Once #68 is resolved, we can ignore some attributes and error on others, so that a compile test would be sufficient.

#68 Stop ignoring attributes 2 months ago

Ticket created by ~mcf on ~mcf/cc-issues

Currently we define away all attributes with -D __attribute__(x)= in config.h.

Some attributes like nodiscard and deprecated can safely be ignored, but others like packed, mode, and constructor have important semantics.

Since attributes are already accepted for C2X (n2335), we should at least be parsing them, ignoring the ones that don't change semantics, and producing an error for the ones that do.

n2335 has this to say about ignoring attributes:

Attributes specified by this document can be parsed but ignored by an implementation without changing the semantics of a correct program; the same is not true for attributes not specified by this document.

The currently accepted attributes for C2X are nodiscard, maybe_unused, and deprecated, which can all be ignored.

#64 enum values that aren't representable as int 2 months ago

Comment by ~mcf on ~mcf/cc-issues

Fixed in 8bae8a47d5.

REPORTED RESOLVED FIXED

#67 qbe: rega.c:215: pmrec: Assertion `KBASE(pm[i].cls) == KBASE(*k)' failed 2 months ago

Comment by ~mcf on ~mcf/cc-issues

Seems to be fixed by https://git.sr.ht/~mcf/qbe/commit/74ed7dfd09b30a03e9e0063e6efbe5c8d408b707.

REPORTED RESOLVED FIXED

#64 enum values that aren't representable as int 2 months ago

Comment by ~mcf on ~mcf/cc-issues

Since this is fairly widespread (used in glibc, linux headers, and elsewhere), I think it makes sense to allow enumerator values up to UINT_MAX as long as no enumerators are negative. This doesn't have the confusing behavior mentioned earlier, and would be sufficient for all cases I've run into so far.

#35 Internal Server Error when deleting wiki 2 months ago

Ticket created by ~mcf on ~sircmpwn/man.sr.ht

I get Internal Server Error when I try to delete my wiki ~mcf/cc, which has been replaced by ~mcf/cproc.

This happens whether or not I check the Delete corresponding repo? box.

#67 qbe: rega.c:215: pmrec: Assertion `KBASE(pm[i].cls) == KBASE(*k)' failed 2 months ago

qbe added by ~mcf on ~mcf/cc-issues

#67 qbe: rega.c:215: pmrec: Assertion `KBASE(pm[i].cls) == KBASE(*k)' failed 2 months ago

Ticket created by ~mcf on ~mcf/cc-issues

Found when compiling mupdf.

Reduced test-case:

struct a {float b;} c(float);
void d(struct a e, float f) {
    c(f);
}

Reduced QBE:

type :T = { s }
export
function $d(:T %.1, s %.2) {
@start
        %.3 =:T call $c(s %.2)
        ret
}

Before register allocation:

export function $d() {
@start
    %.2 =s copy R18
    %abi.1 =l copy R17
    storel %abi.1, [S2]
    R17 =s copy %.2
    call $c, 0104
    %abi.2 =d copy R17
    storel %abi.2, [S0]
    ret0
}

Looks like the assertion is triggering because R17 is used both with class Ks (floating) and Kl (integer). Need to investigate if it is possible to remove this assertion, or prevent this situation from happening.