(In this question, I'm only considering the molecular-biology notion of a gene, not the older Mendelian notion.)
Wikipedia defines a "gene" as "a sequence of nucleotides in DNA that is transcribed to produce a functional RNA", and an "allele" as "a variation of the same sequence of nucleotides at the same place on a long DNA molecule". Typically, one says that different alleles can be different "versions" of the same gene.
Taken literally, these definitions imply that both a "gene" and an "allele" are fully specified by their base pair sequences. But this contradicts that notion that different alleles can be different "versions" of the same gene - which implies that the notion of a "gene" is more general than that of an allele, since different alleles can correspond to the "same" gene.
The notion of "same place" in Wikipedia's definition of an allele seems to suggest that a gene is characterized by its location within a DNA molecule. I.e. two different alleles correspond to the "same gene" if they occur at the same locus on a chromosome.
So what exactly specifies the boundaries of a single gene, i.e. what specifies which alleles correspond to that gene as opposed to a different gene?
Put another way: what is the minimal amount of information required to fully specify a gene? It can't just be a base pair sequence, because that instead seems to define an allele. Is it a particular genetic locus? Or is it defined functionally, i.e. a set of alleles are instances of the "same" gene if they all code for RNA strands that are functionally similar/equivalent? If it's the latter, then is there a precise way to define "functionally similar/equivalent", or is there there some degree of subjective convention in demarking different genes? (If one allele leads to a healthy organism and another allele leads to a nonviable organism, then those seem very functionally different - so is it meaningful to say that those alleles are variations of the "same" gene?)
Or is the resolution just the empirical fact that the functional purpose of a protein is so well-correlated with the locus of its encoding DNA that we can be imprecise about specifying whether the locus or the function defines the gene?
(I've also seen the notion of a "gene" defined purely phenotypically, as in the older Mendelian framework. But my understanding is that in reality, quite few phenotypic parameters are directly controlled by individual genes - most arise from complicated polygenetic interaction effects. So it seems that in practice, a purely phenotypic characterization can't precisely demarcate individual genes.)
Yet another way to frame this same question: is "allele" or "gene" the more primitive concept?